I am trying to pass one parameter from a directive to a method defined in the controller.
I use the selection area.
Here is the corresponding code and demo in the script :
HTML
<div ng-controller="MapCtrl">
<map id="map_canvas" call='callMe()'></map>
</div>
Js
var module = angular.module('googleMap', []);
module.directive('map', function() {
return {
restrict: 'E',
replace: true,
scope:{
callMe : '&call'
},
template: '<div></div>',
link: function(scope, element, attrs) {
console.log(element);
scope.callMe('hey');
}
};
});
function MapCtrl($scope) {
$scope.callMe = function(val){
alert(val);
};
}
Why am I getting val=undefined? It should behey
Thanks,
source
share