如何更新指令范围?
原文链接:https://www.f2er.com/angularjs/143135.html<div ng-controller="MyCtrl"> <p t></p> </div>
我的指令:
var myModule = angular.module('myModule',[]) .directive('t',function () { return { template: '{{text}}',link: function (scope,element,attrs) { scope.text = '1'; element.click(function() { scope.text = '2'; }); } }; }) .controller('MyCtrl',['$scope',function ($scope) { }]);
click指令不更新.