Angular JS Tutorial
iv
Application Module ............................................................................................................................................ 39
Controller Module ............................................................................................................................................... 39
Example .............................................................................................................................................................. 40
Output ................................................................................................................................................................ 43
12. Forms .......................................................................................................................................................... 44
Events ................................................................................................................................................................. 44
ng-click ................................................................................................................................................................ 44
Validate Data ...................................................................................................................................................... 45
Example .............................................................................................................................................................. 45
Output ................................................................................................................................................................ 48
13. Includes ...................................................................................................................................................... 49
Example .............................................................................................................................................................. 49
Output ................................................................................................................................................................ 52
14. AJAX............................................................................................................................................................ 53
Examples ............................................................................................................................................................. 53
Output ................................................................................................................................................................ 56
15. Views .......................................................................................................................................................... 57
ng-view Directive ................................................................................................................................................ 57
Usage .................................................................................................................................................................. 57
ng-template Directive ......................................................................................................................................... 57
Usage .................................................................................................................................................................. 57
$routeProvider Service........................................................................................................................................ 58
Usage 1 ............................................................................................................................................................... 58
Usage 2 ............................................................................................................................................................... 58
Example .............................................................................................................................................................. 59
Output ................................................................................................................................................................ 61
16. Scopes ......................................................................................................................................................... 63
Scope Inheritance ............................................................................................................................................... 63
Example .............................................................................................................................................................. 64
Output ................................................................................................................................................................ 66
17. Services ....................................................................................................................................................... 67
Using Factory Method ........................................................................................................................................ 67
Using Service Method ......................................................................................................................................... 67
Example .............................................................................................................................................................. 68