■ Contents
viii
■ Chapter 2: The Basics of AngularJS �������������������������������������������������������������������������������� 35
Why We Need Frameworks ��������������������������������������������������������������������������������������������������������� 35
What Is a Framework? ����������������������������������������������������������������������������������������������������������������������������������������� 36Downloading and Installing AngularJS ���������������������������������������������������������������������������������������� 36
Browser Support ������������������������������������������������������������������������������������������������������������������������� 37
Your First AngularJS Application ������������������������������������������������������������������������������������������������� 38
Declarative vs� Procedural Programming ������������������������������������������������������������������������������������������������������������ 41Directives and Expressions ���������������������������������������������������������������������������������������������������������������������������������� 41Summary ������������������������������������������������������������������������������������������������������������������������������������� 45
■ Chapter 3: Introduction to MVC ��������������������������������������������������������������������������������������� 47
Design Patterns ��������������������������������������������������������������������������������������������������������������������������� 47
Model View Controller ������������������������������������������������������������������������������������������������������������������������������������������ 51Why MVC Matters ����������������������������������������������������������������������������������������������������������������������������������������������� 52MVC the AngularJS Way��������������������������������������������������������������������������������������������������������������������������������������� 53Summary ������������������������������������������������������������������������������������������������������������������������������������� 56
■ Chapter 4: Filters and Modules ��������������������������������������������������������������������������������������� 57
Introduction to Filters ������������������������������������������������������������������������������������������������������������������ 57
Built-in Filters ������������������������������������������������������������������������������������������������������������������������������ 60
The Number Filter ������������������������������������������������������������������������������������������������������������������������������������������������ 60The Date Filter ����������������������������������������������������������������������������������������������������������������������������������������������������� 62The limitTo Filter �������������������������������������������������������������������������������������������������������������������������������������������������� 65AngularJS Modules ��������������������������������������������������������������������������������������������������������������������� 68
What Is a Module? ����������������������������������������������������������������������������������������������������������������������������������������������� 68