janpantel / angular-sails

An angular module for using the sails socket.io api
MIT License
307 stars 56 forks source link

can't get message from .on #55

Closed misterch0c closed 9 years ago

misterch0c commented 9 years ago

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()...

TheSharpieOne commented 9 years ago

@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.