Wednesday, December 3, 2014

AngularJS Fundamentals In 60-ish Minutes

AngularJS Fundamentals In 60-ish Minutes



- $Scope : Glue between Controller and View.
         : $Scope is ViewModel

- ViewModel : Data for the View or Model for View

- Controllers (in MVC) should not know about View as this makes it depend on View. This allows Controllers to be testable and Multiple Views are possible this way.

- Modules : are containers

- Routes : Maps View and Controller

Tuesday, December 2, 2014

Dependency Injection ( and Dependency Injection Container)

Video : http://www.youtube.com/watch?v=IKD2-MAkXyQ

Dependency : Dependency is has a relationship. Class A has class B. Class Cycle has Tyre.

Injecting Dependency : Dependency is pushed from outside to the class. So in above example Class Cycle instead of instantiating instance of class Tyre, gets an instance of Tyre from outside.

Principal Behind Dependency Injection : We should code to abstractions (interfaces).

Dependency Injection Container Pattern : Used to create dependencies for class\es.  Knows which class has which dependencies and how to instantiate those dependencies.