请教一个angularjs中在指令调用controller方法的问题

2024-12-27 22:32:27
推荐回答(1个)
回答1:



















var app = angular.module('app', []);

app.controller('MyCtrl', function($scope){
$scope.sayHello = function(name) {
alert("Hello"+name);
}
})

app.directive("greeting", function(){
return {
scope: {
greet: '&aa'
},
restrict: "AE",
template: '
'
}
});