ウォッチのコードは一度だけ実行されます。 どうすれば修正できますか?
this.$rootScope.$watch('tabType',() => {
if (this.$rootScope["tabType"] === TabType.Sent) {
this.$scope.refreshSentList();
} else if (this.$rootScope["tabType"] === TabType.Archive) {
this.$scope.refreshArchiveList();
} else if (this.$rootScope["tabType"] === TabType.Inbox) {
this.$scope.refreshInboxList();
} else if (this.$rootScope["tabType"] === TabType.Snooz) {
this.$scope.refreshSnoozList();
} else if (this.$rootScope["tabType"] === TabType.Trash) {
this.$scope.refreshTrashList();
}
},true);
オム、 '$ watch'とnessesaryではありませんどのように影響しないはずしかし
、 'newValue'と' oldValue'という2つのパラメータで動作する可能性があります。 –
最小限で完全でベリファイの良い例を投稿すると助けになるでしょう。http://stackoverflow.co m/help/mcve –
サンプルのポーロー –