问题描述
有人建议在这里:
-
请确保您有socket.io客户端库:
凉亭安装socket.io客户端--save
这并没有与此相同的错误解决我的问题。
-
包括的index.html:
SCRIPT SRC =LIB /角座-IO / socket.js
-
在app.js
angular.module('启动',['离子','starter.controllers','starter.services',
'starter.directives','btford.socket-io的']) -
在services.js
.factory('seatStatusSocket',函数(的SocketFactory){
VAR myIoSocket = io.connect(porturl); // IO是这里没有定义,豁然开朗。 -
据前使用的lib的远程副本的工作。当这个错误开始,我改变了的index.html链接本地副本,因为这远程版本也收到了错误网关错误(现在的罚款,但仍插座IO是不是如上述定义)。
删除:
SCRIPT SRC =http://chat.socket.io/socket.io/socket.io.js
版本
[email protected] node_modules / socket.io
节点--version
v0.12.7
您必须index.html中包括:
SCRIPT SRC =< bowerComponentPath> /socket.io-client/socket.io.js
在此之前:
SCRIPT SRC =< bowerComponentPath> /angular-socket-io/socket.js
和yest这是必需的:
凉亭安装socket.io客户端--save
There was a suggestion here: https://github.com/btford/angular-socket-io/issues/127
make sure you have socket.io client library:
bower install socket.io-client --save
This didn't fix my problem with this same error.
including in index.html:
script src="lib/angular-socket-io/socket.js"
in app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'starter.directives', 'btford.socket-io'])
in services.js
.factory('seatStatusSocket',function(socketFactory){ var myIoSocket = io.connect(porturl); // io is not defined here, suddenly.
It was working before, using a remote copy of the lib. When this error started, I changed index.html to link a local copy, as this remote version also received a Bad Gateway error (now fine, but still socket io is not defined as above).
removed:
script src="http://chat.socket.io/socket.io/socket.io.js"
versions
[email protected] node_modules/socket.io
node --version
v0.12.7
You have to include in index.html:
script src="<bowerComponentPath>/socket.io-client/socket.io.js"
before this:
script src="<bowerComponentPath>/angular-socket-io/socket.js"
and yest this is required:
bower install socket.io-client --save
这篇关于角插座-IO IO是没有定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!