私はディレクティブを使用します。Angular JS指令で2つのバインド方法が動作しないのはなぜですか?
するlist.htmlはreturn {
restrict: 'E',
scope: {
isread: "=isread"
,....
templateUrl: '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に更新されているかどうか確認してください –