Bringing Angular and Pusher together

Yesterday I started looking at the service called Pusher (www.pusher.com) and the need to make it work with Angular. Well it couldn’t have been easier! Here is some code that will work for you.

You will of course need to update API_KEY with your own and change “test_channel” to your own as required.

You may also note that I have adopted the “controller as” syntax in my code and I have done away with $scope, as in Angular 2 that will be gone anyway. I prefer it and it is more in line with how we used to write our JS functions.

Sharing GitHub gists this way is pretty damn sweet too 🙂

https://gist.github.com/nickeblewis/254f861d2b08d4cb7f84.js

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s