パラメータ:requestsとcurrentUserを取得する必要がある独自のディレクティブを作成しようとしています。2番目の変数をisoloatedスコープに渡すことはできませんAngularJS
requestsパラメータが正常にditectiveに渡されましたが、currentUserは渡されません。
currentUserは、$ rootScopeのapp.runで定義されています。
ディレクティブ:
app.directive('requestsTableForBuyer', function() {
return {
'restrict': 'AE',
'templateUrl': '../directives/requestsTables/requestsTableForBuyer.html',
'scope': {
requests: "=",
currentUser: "="
},
'controller': function($scope, $timeout, toaster) {
console.log($scope.currentUser);
}
});
app.run:
私はCurrentUserには 'dashboard.html'
コードでアクセス可能であることに注意しなければならないことはこれです
app.run(function($rootScope) {
$rootScope.currentUser = "ori";
});
dashboard.html(関連部分のみ):
<requests-table-for-buyer requests="requests" currentUser="currentUser"></requests-table-for-buyer>
何が問題であり、どのように修正することができますか?
は疑問符が何を意味するのかを下回るような
<requests-table-for-buyer requests="requests" current-user="currentUser"></requests-table-for-buyer>
変更あなたのスコープバインディング? – Ori