【发布时间】:2016-02-13 08:41:17
【问题描述】:
我有一个 AngularJS 应用程序,我目前正在尝试访问 Leaflet Search 控件的“search_expanded”事件,但没有运气。
这是我的代码:
angular.module('myApp', [ 'leaflet-directive' ])
.controller('ShowMapCtrl', ["$scope", "leafletData", function ($scope, leafletData) {
// some code
leafletData.getMap().then(function(map) {
map.on('search_expanded', function(e){
alert("search control expannded");
});
});
【问题讨论】:
-
尝试做..
$scope.$on('search_expanded', console.log); -
那是我的第一种方法,但没有奏效
-
$rootScope.$on('search_expanded', console.log);第二种方法? -
angular.element(document).on('search_expanded',console.log);第三种方法? -
这很奇怪..你安装了 jQuery 吗?
标签: angularjs leaflet angular-leaflet-directive