Javascript articles
41 views | +0 today
Follow
Your new post is loading...
Your new post is loading...
Rescooped by Sriharsha Sistalam M from JavaScript for Line of Business Applications
Scoop.it!

Real-Time AngularJS SDK with Live Chat Example

Real-Time AngularJS SDK with Live Chat Example | Javascript articles | Scoop.it

Over the past few months, it has been really exciting to follow the phenomenal traction and explosive adoption of AngularJS, an Open Source framework for Web Application development, originally started by developers at Google and now receiving global attention.

Over the course of building a few PubNub-enabled AngularJS applications, we came across a bunch of patterns and features that we thought would be useful for AngularJS developers, for example:

* an Angular service to inject the PubNub object into controllers.

* an Angular-friendly mechanism for binding events to the root scope.

* additional bookkeeping functions for providing easy access to collections (such as the presence and channels lists).


Via Jan Hesse
No comment yet.
Rescooped by Sriharsha Sistalam M from JavaScript for Line of Business Applications
Scoop.it!

Share state between controllers in AngularJS

You start punching out mad code. You set up services, filters, directives and a whole bunch of controllers. It’s all gorgeous. AngularJS makes you write good code. Everything sort of naturally falls into place and even as the code base grows, it never gets unweildy. When you, in brief moments of insanity, try to work against the framework, it prompty punishes you. Not because it is cruel, but to protect you from making architectural mistakes. Monstrosities in unmaintainability. You chant the mantra: “testability, dependency injection, modularity”, and figure it out. You didn’t need to create a class in order to contain that piece of conversion logic, you needed a filter. Everything is right again.

Eventually you end up at the point where one controller needs to talk to another controller. And AngularJS fails you. Now really, this isn’t a failure on AngularJS’s part at all, but rather just a result of keeping all dependencies handled by a DI framework. Your controller has some state, and another controller also wants the same state. This could be a username, a config object, just about anything. Of course, now you see it.You need a service.


Via Jan Hesse
No comment yet.