为什么在指令Angular JS中不能使用两种绑定方式?

时间:2017-03-09 09:03:38

标签: angularjs

我使用指令:

 return {
   restrict: 'E',
     scope: {
         isread: "=isread"
     ,....
     templateUrl: 'list.html',

list.html是:

<span ng-show="isread"></span>

父母在我调用指令的地方进行修改:

<div class="top-menu" ng-controller="NotificationController">
  <notification-list isread="is_read"></notification-list>
</div>

NotificationController

scope.makeRead = function() {
  $scope.is_read = true;
}

为什么当我在控制器中更改$scope.is_read = true;时,它在变量isread中的指令中没有更改?

1 个答案:

答案 0 :(得分:0)

return {
 restrict: 'E',
 scope: {
     isread: "="
 ,....
 templateUrl: 'list.html',