chrisenytc / ng-socket

Angular Module for Socket.io
MIT License
49 stars 18 forks source link

ngSocket module can't initialize #5

Closed IgorDePaula closed 9 years ago

IgorDePaula commented 10 years ago

I am using ng-scaffold and I got the error:

Error: [$injector:modulerr] Failed to instantiate module Restaurante due to:
Error: [$injector:modulerr] Failed to instantiate module ngSocket due to:
Error: [$injector:nomod] Module 'ngSocket' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

My scripts on page are:

    <script src="../bower_components/socket.io-client/dist/socket.io.js"></script>
    <script src="../bower_components/socket.io/lib/socket.io.js"></script>
    <script src="../bower_components/angular/angular.js"></script>
    <script src="../bower_components/angular/i18n/angular-locale_pt-br.js"></script>
    <script src="../bower_components/angular-ui-router/release/angular-ui-router.js"></script>
    <script src="../bower_components/angular-animate/angular-animate.js"></script>
    <script src="../bower_components/angular-cookies/angular-cookies.js"></script>
    <script src="../bower_components/angular-resource/angular-resource.js"></script>
    <script src="../bower_components/angular-sanitize/angular-sanitize.js"></script>
    <script src="../bower_components/angular-touch/angular-touch.js"></script>

    <script src="../bower_components/ng-socket/ngSocket.js"></script>

In config.js

angular.module('Restaurante.config', [
'produtos', 'template.app', 'ui.router', 'ngAnimate', 'ngCookies', 'ngResource', 'ngSanitize', 'ngTouch', 'ngSocket' ])....

and in app.js

angular.module('Restaurante', [ 'Restaurante.config', 'service.produtos', 'service.vendas', 'ngSocket' ])...... .controller('VendasCtrl', function($scope, $socket, vendas) { 'use strict'; $scope.isLoading = true; $scope.produtos = vendas.getAtivo(function() { $scope.isLoading = false; }); ....

and the error is same...

loadedsith commented 9 years ago

have you tried the array injection technique? controller('VendasCtrl',['$scope', '$socket', 'vendas', function($scope, $socket, vendas) {...})]); Other than that, this looks exactly like my working setup.