行がクリックされたときに詳細画面を表示するディレクティブがあります。私は出会いを更新しようとしています。ディレクティブは次のとおりです。
angular.module('app').directive('chatContainer', function() {
return {
scope: {
encounter: '=',
count: '='
},
templateUrl: 'views/chat.container.html',
link: function(scope, elem) {
};
});
ディレクティブのテンプレートは次のとおりです。
<div class="span4 chat-container">
<h5 class="chat-header">
<span class="container">{{encounter.patient.firstName }} {{encounter.patient.lastName}}</span>
</h5>
</div>
ディレクティブが html で宣言されている場所は次のとおりです。
<div chat-container encounter="selectedEncounter" count="count"></div>
行がクリックされたときに呼び出されるコントローラーは次のとおりです。
angular.module('app').controller('EncounterCtrl', function ($scope, singleEncounter) {
$scope.count = 500;
$scope.selectedIndex = -1;
$scope.selectedEncounter = -1;
$scope.getSelectedRow = function($index) {
$scope.selectedIndex = $index;
$scope.selectedEncounter = $scope.encounters[$scope.selectedIndex];
};
$scope.encounter = singleEncounter.selectedEncounter;
});
関数に入ると、正しい出会いgetSelectedRow()
に変わります。selectedEncounter
バインディングは、選択範囲を my に渡しませんchatContainer
。encounter
ディレクティブ スコープでを宣言し、それ=
をスコープ タイプとして指定すると、それがバインドされると思いましたが、何か不足していますか???