我有一个例子angularJS
@H_403_8@<div ng-controller="testCtrl"> <test color1="color1" updateFn="updateFn()"></test> </div> <script> angular.module('dr',[]) .controller("testCtrl",function($scope) { $scope.color1 = "color"; $scope.updateFn = function() { alert('123'); } }) .directive('test',function() { return { restrict: 'E',scope: {color1: '=',updateFn: '&'},template: "<button ng-click='updateFn()'>Click</button>",replace: true,link: function(scope,elm,attrs) { } } }); </script> </body> </html>
我想当我点击按钮,警报框会出现,但没有显示。
谁能帮助我?