Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to provide a socket URL as a parameter to the socketFactory #142

Open
jlethuau opened this issue Apr 7, 2016 · 1 comment
Open

Comments

@jlethuau
Copy link

jlethuau commented Apr 7, 2016

Hi!
Not really an issue but a question :)

Since I had the same 404 issues in my console with the example code, I've tried the solution provided here and it works great : #82

   ...
   .factory('mySocket', function (socketFactory) {
        return socketFactory({
            ioSocket: io('http://XX.XX.XX.XX:12345') // Local ENV
            // ioSocket: io('http://YY.YY.YY.YY:9000') // Staging 
        });
    });

My problem: I need to switch between URLs when I deploy my app and it's painful if I have to do it manually in the app.js file everytime...

Question: How can I make this URL become a parameter of my Angular app? If I use ng-init to define this value, how can I use it in the socketFactory?

Thanks for your help!

@louiealmeda
Copy link

You should define the URL as a constant then inject it to your mySocket service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants