2
小さなアプリケーションを作成していて、テンプレートに次の指示があります。置き換えを使用すると、角孤立スコープの値がテンプレートに表示されない
smallgrid.directive.js:
angular.module('myActions')
.directive('smallgrid', ['$rootScope', function($rootScope) {
return {
restrict: "E",
scope: {
actionable: "="
},
controller: function($scope) {
$scope.setLocation = function() {
console.log("yee");
};
}
};
}])
.directive('three', function() {
return {
replace: true,
templateUrl: '/app/my_actions/directives/templates/grid3x3.template.html'
};
})
.directive('four', function() {
return {
replace: true,
templateUrl: '/app/my_actions/directives/templates/grid4x4.template.html'
};
})
.directive('five', function() {
return {
replace: true,
templateUrl: '/app/my_actions/directives/templates/grid5x5.template.html'
};
});
grid3x3.template.html
<div class="k-edit-field" id="board">
<div class="row" ng-click="setLocation()">
{{actionable.probability}}
</div>
</div>
次のように私はこのディレクティブを使用します。
<smallgrid three actionable="currentAction.actionable" ng-if="somecondition"></smallgrid>
UIが正しくレンダリングされます。ただし、{{actionable.probability}}
が空で、Clickイベントが発生していないことを示しています。ただし、分離スコープを削除して変数に直接アクセスすると、値を取得できます。私は、孤立スコープを使用しているときにthree
指示文でsmallgrid
の値にアクセスできないことを理解しています。 smallgrid
の値をテンプレートに渡す方法はありますか?
恐ろしいへのアクセス権を持っていなければなりません。説明的な答えをありがとう。 –