2013-10-03 27 views
15

Kapsamı direktifte nasıl güncelleyebilirim?Angular.js Bir direktifin kapsamı nasıl güncellenir?

<div ng-controller="MyCtrl"> 
    <p t></p> 
</div> 

Benim yönergesi: tık yönergesi değil güncelleştirme

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) { 
    }]); 

sonra.

cevap