Beginning AngularJS
Chapter 4 ■ Filters and Modules We have talked about the Separation of Concerns principle, so let us take a moment to consider w ...
Chapter 4 ■ Filters and Modules Listing 4-4. Rounding Up Values with the Number Filter <!DOCTYPE html> Listing 4-4 fun ...
Chapter 4 ■ Filters and Modules Of course, two digits would be far better and much more in line with end users’ expectations. As ...
Chapter 4 ■ Filters and Modules Table 4-1. Date Filter Parameters Parameter Description yyyy Four-digit representation of year ( ...
Chapter 4 ■ Filters and Modules The parameters in Table 4-1 certainly provide the ability to mix and match and create nearly any ...
Chapter 4 ■ Filters and Modules medium: {{ data.dateJoined | date:'medium'}} mediumDate: {{ data.dateJoined | date:'mediumDate' ...
Chapter 4 ■ Filters and Modules Listing 4-6. Adding Historical Data to the Data Source function MyFilterDemoCtrl($scope) { var ...
Chapter 4 ■ Filters and Modules Using ngRepeat, we loop through the monthlyUsageHistory array and output each value (which itsel ...
Chapter 4 ■ Filters and Modules AngularJS Modules So far, we have not looked at AngularJS modules. Instead, we have placed all o ...
Chapter 4 ■ Filters and Modules Again, we get to provide a name ('MyFilterDemoCtrl') and pass in a function. This function is ba ...
Chapter 4 ■ Filters and Modules Listing 4-9. Referring to the Module by Name // Create a new module angular.module('myAppModule' ...
Chapter 4 ■ Filters and Modules Creating a Custom Filter At last, it’s time to look at creating a custom filter. Modules are gre ...
Chapter 4 ■ Filters and Modules Listing 4-12. An Angular Filter Implementation myAppModule.filter('stripDashes', function () { / ...
Chapter 4 ■ Filters and Modules console.log(toTitleCase("jennifer")); console.log(toTitleCase("jENniFEr")); console.log(toTitleC ...
Chapter 4 ■ Filters and Modules Of course, the function is now a little more complicated. The trick to understanding it lies in ...
Chapter 5 Directives Most JavaScript frameworks have a “special something” that sets them apart. That special something in the c ...
CHApTer 5 ■ DIreCTIveS The Basics of Directives What do directives look like? You are no doubt thinking that you have seen enoug ...
CHApTer 5 ■ DIreCTIveS Listing 5-1 shows product-detail.html. This is the HTML and CSS code for a product selection page. We wil ...
CHApTer 5 ■ DIreCTIveS purple { background-color: purple; } gray { background-color: gray; } olive { background-color: olive; } ...
CHApTer 5 ■ DIreCTIveS The interesting thing about this implementation is how the logic is assembled. It’s intuitive, and it doe ...
«
1
2
3
4
5
6
7
8
9
10
»
Free download pdf