这里有一个建议:https://github.com/btford/angular-socket-io/issues/127 https://github.com/btford/angular-socket-io/issues/127
这并没有解决我的问题与同样的错误。
-
包括在index.html中:
script src="lib/angular-socket-io/socket.js"
-
在app.js中
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services',
'starter.directives', 'btford.socket-io'])
-
在 services.js 中
.factory('seatStatusSocket',function(socketFactory){
var myIoSocket = io.connect(porturl); // io is not defined here, suddenly.
它之前可以使用该库的远程副本来工作。当这个错误开始时,我更改了index.html以链接本地副本,因为这个远程版本也收到了Bad Gateway错误(现在很好,但仍然没有像上面那样定义socket io)。
removed:
script src="http://chat.socket.io/socket.io/socket.io.js"
versions
[email protected] /cdn-cgi/l/email-protection node_modules/socket.io
node --version
v0.12.7
您必须在index.html中包含:
script src="<bowerComponentPath>/socket.io-client/socket.io.js"
在这之前:
script src="<bowerComponentPath>/angular-socket-io/socket.js"
是的,这是必需的:
bower install socket.io-client --save
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)