Monday 15 February 2010

angularjs - Angular service not updating on model change -


In the app I have a service that keeps my work:

  App.factory 'Task', function () {var work = []; Return {getAll: function () {return function;}, addOne: function {tasks.push (function);}, openBy: function (owner) {return (where work, owner: owner, status: 'open' ));}, Done: function (owner) {back _.where (function, owner: owner, status: 'off'});},};});   

Then I show, per boss, either their open work or closed work.

The problem is that when I update tasks using Tasks.addOne (work); Those works that use Tasks.openBy (owner) are not updated. Those people who do workarounds are not.

That's because I am returning a new array? If this is the case, is there any way for the administrator to update this? Or am I completely wrong in the first place and is there a better way of doing this?

Any help would be greatly appreciated.

Matthew

Instead of viewing what you can do, the controller (or instructions) In order to call the openBy function and make it a $ radius $ Viewing as an example:

  // Controller body app.controller ('functional', function ($ radius, function) {$ scope.allTasks = action.get ALL ( ); $ Radius. $ Watch ('All Tasks', function () {// Assume that the user is a user and above it $ scope.ownedTasks = top.openBy (owner);}, true);}) Has been introduced somewhere;   

This should work, even if I think it is possible that something is more beautiful!

No comments:

Post a Comment