7

In angular I found out you can bind a template to a function which returns an array, like this:

<div class="cal_row" id ="id_{{task.id}}" ng-repeat="task in calendar.filtered()">
  <div class="id">{{task.id}}</div>
      <div class="task">{{task.task}}</div>
  <div class="start">{{task.start}}</div>
  <div class="finish">{{task.finish}}</div>
</div>

It's pretty cool, because that way I can, for example, avoid having to keep a variable around just to maintain the filtered version of the data.

However, I also loose the binding with the original data: when the underlying data changes, I can't seem to get angular.js to spot the change, and update the view.

Is there a way to do that? I tried to find anything in the docs, but couldn't

Thanks a lot

1 Answer 1

7

If you make a change to some data from outside angular, you have to use $myScope.$apply so angular knows something has changed. http://docs.angularjs.org/api/ng.$rootScope.Scope#$apply

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.