Details of Angularjs internal working