AngularJs and the Component Pattern

A few tips and a few standards related to using the component pattern with AngularJs. Highly suggsted to start writing your AngularJs project with this pattern in mind due to the migration path to AngularJs 2.0.

  • Don’t use ng-controllers; instead modularize your code into directives.
  • Reduce your reference to $scope. Instead use ControllerAs with vm.
  • Utilize the PubSub pattern; communicate between directives (components) with loosely coupled events.
  • Keep AngularJs 2.0 in the back of your mind while writing your AngularJs apps.
  • For further Reference concerning these patterns, see the following post.
Written on March 3, 2015