Answer the question
In order to leave comments, you need to log in
How to call the execution of a function after changing the object in $scope?
Hello. There is a loop in which I display information:
<ul class="list-group"
ng-init="curMarks=getTaskVotesModalInfo(task)"
>
<li ng-repeat="info in curMarks"
class="list-group-item"
>
<span>{{info.worker}}</span>
<span class="badge">
{{info.mark}}
</span>
</li>
</ul>
Answer the question
In order to leave comments, you need to log in
Now, if it would be possible to build a model in the controller, and the view would only draw it ...
<ul class="list-group">
<li ng-repeat="info in $ctrl.curMarks" class="list-group-item">
<span>{{info.worker}}</span>
<span class="badge">
{{info.mark}}
</span>
</li>
</ul>
function MyCtrl() {
var vm = this;
vm.curMarks = null;
function changeTask() {
task = [{worker: 'Sergey', mark: '@Neversmille'}];
vm.curMarks = getTaskVotesModalInfo(task);
}
function init() {
vm.curMarks = getTaskVotesModalInfo(task);
}
init();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question