Note that there are some explanatory texts on larger screens.

plurals
  1. POangular $watch over a particular field for all objects of an array
    text
    copied!<p>I have an array of halls like this, which I am getting from a $http.get(). </p> <pre><code>$scope.halls = [ { "_id": "524886d4c6d8a5a3b8949f6f", "alias": "", "hallId": "2", "locationHint": "Near support team", "name": "Conference Hall", "bookQueue": [], "occupancy": { "occupied": true, "occupiedBy": "Vignesh", "purpose": "Sync up", "team": "Edge", "timeRange": { "from": "2013-10-02T19:08:44.752Z", "to": "2013-10-02T19:08:44.752Z" } }, "capabilities": [ "ceiling mic", "room speaker", "projector", "Mac machine" ] }, { "_id": "524886fbc6d8a5a3b8949f70", "alias": "", "hallId": "3", "locationHint": "Near Edge Team", "name": "Training room", "bookQueue": [], "occupancy": { "occupied": true, "occupiedBy": "Tharma", "purpose": "Review", "team": "Platform", "timeRange": { "from": "2013-10-02T19:08:44.752Z", "to": "2013-10-02T19:08:44.752Z" } }, "capabilities": [ "ceiling mic", "room speaker", "projector" ] }, { "_id": "52488794c6d8a5a3b8949f71", "alias": "", "hallId": "4", "locationHint": "Near front office", "name": "Front Office Discussion room", "bookQueue": [], "occupancy": { "occupied": false, "occupiedBy": "", "purpose": "", "team": "", "timeRange": { "from": "2013-10-02T19:08:44.752Z", "to": "2013-10-02T19:08:44.752Z" } }, "capabilities": [ "ceiling mic", "room speaker", "TV" ] } ] </code></pre> <p>I want to update the <code>hall.occupancy</code>, when the current date ( <code>Date.now()</code> )is greater than <code>hall.occupancy.timeRange.to</code> . In this case, I am not going to watch <code>hall.occupancy.timeRange.to</code> because, it is not the property that is going to change. Is there an angular way to do this, because it would get really messy to put a <code>setInterval</code>. </p> <p>I am not really sure on how to go about this. </p> <p>I am still in the early stages of learning angular, so it would be good if you were gentle in pointing out an efficient way. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload