4

私は次のコードを持っています:

状態(簡単にするために短くしましょう)

.state('foo', {
    url: '/foo',
    templateUrl: 'path/to/template.html',
    controller:'fooCtrl',
})

コントローラー

controller = function($scope){
    // not the actual code
    $scope.barCount
}

template.html

<div>
    <span>{{ barCount }}</span> // this is updating properly
</div>

その他の html 部分

<div ng-controller="fooCtrl">
    <span>{{ barCount }}</span> // this is **NOT** updating properly
</div>

controllerscopeに変数があります。controllerと一緒に宣言されたテンプレートで、双方向バインディングが正常に機能しています。しかし、.を使用してコントローラーをバインドした他の部分テンプレートではそうではありません。stateng-controller

これは何かのバグですか?または、何か不足していますか?ありがとう。

4

1 に答える 1