我试图尽可能地限制我在控制器中使用$ scope,并将其替换为Controller作为语法。
@H_403_1@我当前的问题是,我不知道如何调用$ scope。$ apply()在我的控制器中,而不使用$ scope。
@H_403_1@编辑:我正在使用TypeScript 1.4与角度
@H_403_1@我有这个功能
在我看来没有更新:
原文链接:https://www.f2er.com/angularjs/144118.htmlsetWordLists() { this.fetchInProgress = true; var campaignId = this.campaignFactory.currentId(); var videoId = this.videoFactory.currentId(); if (!campaignId || !videoId) { return; } this.wordsToTrackFactory.doGetWordsToTrackModel(campaignId,videoId) .then((response) => { this.fetchInProgress = false; this.wordList = (response) ? response.data.WordList : []; this.notUsedWordList = (response) ? response.data.NotUsedWords : []; }); }@H_403_1@被叫来
$scope.$on("video-switch",() => { this.setWordLists(); });@H_403_1@它是(数组wordList而notUsedWordList)
在我看来没有更新:
<div class="wordListWellWrapper row" ng-repeat="words in wordTrack.wordList"> <div class="col-md-5 wordListWell form-control" ng-class="(words.IsPositive)? 'posWordWell': 'negWordWell' "> <strong class="wordListWord">{{words.Word}}</strong> <div class="wordListIcon"> <div class="whiteFaceIcon" ng-class="(words.IsPositive)? 'happyWhiteIcon': 'sadWhiteIcon' "></div> </div> </div> <div class="col-md-2"> <span aria-hidden="true" class="glyphicon-remove glyphicon" ng-click="wordTrack.removeWord(words.Word)"></span> </div> </div>@H_403_1@按照同样的条件申请,是否有另一种方式调用$ scope。$ on使用Controller作为? @H_403_1@谢谢!