diegopamio / angular-sails-bind

An angular service to bind scope models to sailsjs models thru socket
MIT License
136 stars 25 forks source link

Add callback function for angular controller #22

Closed arryon closed 9 years ago

arryon commented 9 years ago

The standard method of loading content using $http in Angular has the option to specify a success callback when the content has loaded, so that in the controller, you can initiate scope bindings dependent on data. The angular-sails-bind directive has no such thing. I implemented it myself in https://github.com/arryon/angular-sails-bind/commit/0ec49070f32bce1c384d023d5f5781b1fdc76528 but probably there is a better way to do this, like the default .success() and .error() paradigm. Any ideas?

spunkedy commented 9 years ago

I have solved this by adding a $watch to the object and passing a function to the watch.

diegopamio commented 9 years ago

I've merged your changes from your fork to do it, thanks!