Complete Angular 2 Secrets & Tips For Professionals

Transcription

Angular 2Complete Tips & Secrets for ProfessionalsCompleteAngular 2Tips & Secretsfor Professionals100 pagesof professional hints and tricksGoalKicker.comFree Programming BooksDisclaimerThis is an uno cial free book created for educational purposes and isnot a liated with o cial Angular 2 group(s) or company(s).All trademarks and registered trademarks arethe property of their respective owners

ContentsAbout . 1Chapter 1: Getting started with Angular 2 . 2Section 1.1: Getting started with Angular 2 with node.js/expressjs backend (http example included) . 2Section 1.2: Install angular2 with angular-cli . 7Section 1.3: Getting started with Angular 2 without angular-cli. . 9Section 1.4: Getting through that pesky company proxy . 13Section 1.5: Keeping Visual Studios in sync with NPM and NODE Updates . 14Section 1.6: Let's dive into Angular 4! . 15Chapter 2: Dynamically add components using ViewContainerRef.createComponent . 19Section 2.1: A wrapper component that adds dynamic components declaratively . 19Section 2.2: Dynamically add component on specific event(click) . 20Section 2.3: Rendered dynamically created component array on template html in Angular2 . 21Chapter 3: Pipes . 24Section 3.1: Custom Pipes . 24Section 3.2: Built-in Pipes . 25Section 3.3: Chaining Pipes . 26Section 3.4: Debugging With JsonPipe . 26Section 3.5: Dynamic Pipe . 26Section 3.6: Unwrap async values with async pipe . 27Section 3.7: Stateful Pipes . 27Section 3.8: Creating Custom Pipe . 28Section 3.9: Globally Available Custom Pipe . 29Section 3.10: Extending an Existing Pipe . 29Section 3.11: Testing a pipe . 29Chapter 4: Routing (3.0.0 ) . 30Section 4.1: Controlling Access to or from a Route . 30Section 4.2: Add guard to route configuration . 32Section 4.3: Using Resolvers and Guards . 32Section 4.4: Use Guard in app bootstrap . 33Section 4.5: Bootstrapping . 34Section 4.6: Configuring router-outlet . 34Section 4.7: Changing routes (using templates & directives) . 35Section 4.8: Setting the Routes . 35Chapter 5: Http Interceptor . 36Section 5.1: Using our class instead of Angular's Http . 36Section 5.2: Simple Class Extending angular's Http class . 37Section 5.3: Simple HttpClient AuthToken Interceptor (Angular 4.3 ) . 38Chapter 6: Directives . 38Section 6.1: *ngFor . 38Section 6.2: Attribute directive . 39Section 6.3: Component is a directive with template . 40Section 6.4: Structural directives . 40Section 6.5: Custom directive . 40Section 6.6: Copy to Clipboard directive . 40Section 6.7: Testing a custom directive . 41Chapter 7: Installing 3rd party plugins with angular-cli@1.0.0-beta.10 . 43Section 7.1: Add 3rd party library that does not have typings . 43

Section 7.2: Adding jquery library in angular-cli project . 43Chapter 8: Testing an Angular 2 App . 45Section 8.1: Setting up testing with Gulp, Webpack, Karma and Jasmine . 45Section 8.2: Installing the Jasmine testing framework . 49Section 8.3: Testing Http Service . 49Section 8.4: Testing Angular Components - Basic . 50Chapter 9: Routing . 51Section 9.1: ResolveData . 51Section 9.2: Routing with Children . 52Section 9.3: Basic Routing . 53Section 9.4: Child Routes . 55Chapter 10: Optimizing rendering using ChangeDetectionStrategy . 56Section 10.1: Default vs OnPush . 56Chapter 11: Lifecycle Hooks . 57Section 11.1: OnChanges . 57Section 11.2: OnInit . 58Section 11.3: OnDestroy . 58Section 11.4: AfterContentInit . 58Section 11.5: AfterContentChecked . 59Section 11.6: AfterViewInit . 59Section 11.7: AfterViewChecked . 59Section 11.8: DoCheck . 60Chapter 12: Directives & components : @Input @Output . 60Section 12.1: Angular2 @Input and @Output in a nested component . 60Section 12.2: Input example . 61Section 12.3: Angular2 @Input with asynchronous data . 62Chapter 13: Angular RXJS Subjects and Observables with API requests . 64Section 13.1: Wait for multiple requests . 64Section 13.2: Basic request . 64Section 13.3: Encapsulating API requests . 64Chapter 14: Zone.js . 65Section 14.1: Getting reference to NgZone . 65Section 14.2: Using NgZone to do multiple HTTP requests before showing the data . 65Chapter 15: Services and Dependency Injection . 66Section 15.1: Example service . 66Section 15.2: Example with Promise.resolve . 66Section 15.3: Testing a Service . 67Chapter 16: Angular 2 Forms Update . 69Section 16.1: Angular 2 : Template Driven Forms . 69Section 16.2: Angular 2 Form - Custom Email/Password Validation . 70Section 16.3: Simple Password Change Form with Multi Control Validation . 71Section 16.4: Angular 2 Forms (

Angular 2 Angular 2Complete Tips & Secrets for ProfessionalsComplete Tips & Secrets for Professionals Disclaimer This is an uno cial free book created for educational purposes and is not a liated with o cial Angular 2 group(s) or company(s). All trademarks and registered trademarks are the property of their respective owners GoalKicker.com Free Programming Books 100 pages of professional .