janpantel/angular-sails

can't get message from .on

misterch0c opened this issue · 1 comments

I'm facing the same issue as #20 so past and get works fine

```$sails.on("user", function (message) {
  console.log('someuser');

});
$sails.on("welcome", function (message) {
  console.log('welcome');

});```

I don't get any message. I can get it using the sails client but I'm wondering how does my angular app even know what host the message comes from? with the sails client I would do io.sails.url=myurl;
I'm using sails 0.11
edit: well, my bad... I was subscribing instead of using watch()...

@misterch0c there is also $sails.$modelUpdater(name, models<array>) which is not apparently documented. You pass it the name such as "user" and an array that would be in your scope and it will update the array whenever something happens.

Also, $sailsProvider.url ($sailsProvider is injectable in the app's config) is where you can override the url. The default is the current domain.