diegopamio / angular-sails-bind

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

Error: io.socket is undefined #20

Open peazz opened 10 years ago

peazz commented 10 years ago

I am trying to integrate this with my angular project but as soon as I make a call inside a controller I get the following error:

 Error: io.socket is undefined
 _get@http://localhost:9000/bower_components/angular-sails-bind/angular-sails-bind.js:179:13

I have confirmed that sails.io.js is being included before angular etc etc, any ideas?

rshewade commented 9 years ago

I am facing the same issue too. Is there any other js file to be included like sails.io.js etc.

eamador commented 9 years ago

Same issue here too, did you manage to fix it?

peazz commented 9 years ago

Yeah I did, you need to manually include Sails.io.js before loading Angular Sails binds, the plug in does work it just not include the required file.

diegopamio commented 9 years ago

Yes, sorry for the long delay in answering, I've been really busy at may day-job.

You should include sails.io.js. It gets added by default on sailjs projects. I may need to add that to the readme.

yura415 commented 9 years ago

Hi everyone. I think that I've had experienced this issue. Here is how scripts included:

  <script src="js/dependencies/sails.io.js"></script>
  <!-- build:js(src) scripts/vendor.js -->
  <!-- bower:js -->
......
  <script src="../bower_components/angular-sails-bind/dist/angular-sails-bind.js"></script>
.......
  <script src="../bower_components/angular-socket-io/socket.js"></script>
.......
  <!-- endbower -->
  <!-- endbuild -->

And here is my code:

  /** @ngInject */
  function DataRowsController(..., $scope, $sailsBind, ...) {
...
    $sailsBind.bind("proxy", $scope);
...
  }

If I navigate to some route that not uses sails-bind (so sails.io will connect normally) and then navigate to route that uses it -- it works OK. But if I open app at route that uses sails-bind, it will fail with error: screen shot 2015-10-01 at 13 51 43