1
我用指令:爲什麼不能在指令Angular JS中使用兩種綁定方式?
return {
restrict: 'E',
scope: {
isread: "=isread"
,....
templateUrl: 'list.html',
其中list.html是:
<div class="top-menu" ng-controller="NotificationController">
<notification-list isread="is_read"></notification-list>
</div>
而且NotificationController
:
scope.makeRead = function() {
$scope.is_read = true;
}
從那裏我稱之爲指令
<span ng-show="isread"></span>
和家長trmplate
爲什麼當我在控制器中更改$scope.is_read = true;
時,在變量isread
中的指令中沒有更改?
如何在控制器中檢查「is_read」正在更新爲true? –
默認情況下它是:'$ scope.is_read = false'在控制器中 – Daniel
檢查控制器中的$ scope.is_read是否更新爲true –