ng-book the complete book on angular6

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Author(s): Nate Murray, Felipe Coury, Ari Lerner, Carlos Taborda
Publisher: Fullstack / Gistia
Year: 2018

Language: English
Pages: 685
Tags: ng-book2, ng-book for angular6, fullstack ng-book

Table of Contents......Page 4
We'd love to hear from you!......Page 18
Running Code Examples......Page 19
Code Block Numbering......Page 20
Getting Help......Page 21
Technical Support Response Time......Page 22
Chapter Overview......Page 23
Simple Reddit Clone......Page 24
Getting started......Page 26
TypeScript......Page 27
Angular CLI......Page 28
Example Project......Page 29
Running the application......Page 33
Making a Component......Page 35
Component Decorators......Page 37
Adding a template......Page 38
Adding CSS Styles with styleUrls......Page 39
Loading Our Component......Page 40
Adding Data to the Component......Page 41
Working With Arrays......Page 44
Using the User Item Component......Page 47
Rendering the UserItemComponent......Page 48
Passing an Input value......Page 49
Bootstrapping Crash Course......Page 51
bootstrap......Page 53
Expanding our Application......Page 54
Adding CSS......Page 55
The Application Component......Page 56
Adding Interaction......Page 58
Adding the Article Component......Page 62
Creating an Article class......Page 71
Storing Multiple Articles......Page 76
Configuring the ArticleComponent with inputs......Page 77
Rendering a List of Articles......Page 79
Adding New Articles......Page 81
Displaying the Article Domain......Page 82
Re-sorting Based on Score......Page 83
Deployment......Page 84
Building Our App for Production......Page 85
Full Code Listing......Page 86
Getting Help......Page 87
Angular is built in TypeScript......Page 88
What do we get with TypeScript?......Page 89
Types......Page 90
Trying it out with a REPL......Page 91
Built-in types......Page 92
Properties......Page 94
Methods......Page 95
Constructors......Page 97
Inheritance......Page 98
Fat Arrow Functions......Page 100
Template Strings......Page 102
Wrapping up......Page 103
Application......Page 104
The Breadcrumbs Component......Page 105
The Product List Component......Page 106
How to Use This Chapter......Page 108
Product Model......Page 109
Components......Page 110
Component template......Page 112
Adding A Product......Page 113
Viewing the Product with Template Binding......Page 115
Adding More Products......Page 116
Selecting a Product......Page 117
Listing products using ......Page 118
The ProductsListComponent......Page 121
Component inputs......Page 122
Component outputs......Page 124
Emitting Custom Events......Page 125
Writing the ProductsListComponent Controller Class......Page 127
Writing the ProductsListComponent View Template......Page 128
The Full ProductsListComponent Component......Page 130
The ProductRowComponent Component......Page 132
ProductRowComponent Configuration......Page 133
ProductRowComponent template......Page 134
The PriceDisplayComponent Component......Page 135
The ProductDepartmentComponent......Page 136
NgModule and Booting the App......Page 137
Booting the app......Page 139
Deploying the App......Page 140
A Word on Data Architecture......Page 141
NgIf......Page 143
NgSwitch......Page 144
NgStyle......Page 146
NgClass......Page 149
NgFor......Page 152
Getting an index......Page 157
NgNonBindable......Page 158
Conclusion......Page 159
FormControl......Page 160
FormGroup......Page 161
Our First Form......Page 162
Loading the FormsModule......Page 163
Simple SKU Form: template......Page 164
Try it out!......Page 168
Using FormBuilder......Page 170
Using FormBuilder......Page 171
Using myForm in the view......Page 172
Try it out!......Page 173
Adding Validations......Page 175
Explicitly setting the sku FormControl as an instance variable......Page 176
Custom Validations......Page 182
Watching For Changes......Page 184
ngModel......Page 185
Wrapping Up......Page 187
Dependency Injection......Page 188
Injections Example: PriceService......Page 189
Dependency Injection Parts......Page 193
Playing with an Injector......Page 194
Providing Dependencies with NgModule......Page 198
Using a Class......Page 200
Using a Factory......Page 205
Dependency Injection in Apps......Page 208
More Resources......Page 209
Introduction......Page 210
import from @angular/common/http......Page 211
A Basic Request......Page 212
Building the SimpleHttpComponent template......Page 213
Building the SimpleHttpComponent Controller......Page 214
Full SimpleHttpComponent......Page 216
Writing a YouTubeSearchComponent......Page 217
Writing a SearchResult......Page 218
Writing the YouTubeSearchService......Page 219
Writing the SearchBoxComponent......Page 224
Writing SearchResultComponent......Page 231
Writing YouTubeSearchComponent......Page 232
Making a POST request......Page 236
PUT / PATCH / DELETE / HEAD......Page 237
Summary......Page 238
Why Do We Need Routing?......Page 239
How client-side routing works......Page 240
The evolution: HTML5 client-side routing......Page 241
Imports......Page 242
Routes......Page 243
Installing our Routes......Page 244
RouterOutlet using ......Page 245
Putting it all together......Page 247
HomeComponent......Page 249
ContactComponent......Page 250
Application Component......Page 251
Configuring the Routes......Page 252
Routing Strategies......Page 254
Running the application......Page 255
Route Parameters......Page 257
ActivatedRoute......Page 258
Music Search App......Page 259
First Steps......Page 261
The SpotifyService......Page 262
The SearchComponent......Page 263
Trying the search......Page 271
TrackComponent......Page 274
Router Hooks......Page 276
AuthService......Page 277
LoginComponent......Page 279
ProtectedComponent and Route Guards......Page 280
Nested Routes......Page 287
Configuring Routes......Page 288
ProductsModule......Page 289
Summary......Page 293
An Overview of Data Architecture......Page 294
Data Architecture in Angular......Page 295
Learning Reactive Programming and RxJS......Page 296
Chat App Overview......Page 298
Components......Page 299
Models......Page 300
Summary......Page 301
Thread......Page 302
Message......Page 303
Implementing UsersService......Page 304
currentUser stream......Page 305
Setting a new user......Page 306
UsersService.ts......Page 307
the newMessages stream......Page 308
The Operation Stream Pattern......Page 310
Sharing the Stream......Page 312
Adding Messages to the messages Stream......Page 313
Our completed MessagesService......Page 316
Trying out MessagesService......Page 319
A map of the current set of Threads (in threads)......Page 321
The currently selected Thread (in currentThread)......Page 326
The list of Messages for the currently selected Thread (in currentThreadMessages)......Page 328
Our Completed ThreadsService......Page 331
Data Model Summary......Page 333
Building Our Views: The AppComponent Top-Level Component......Page 334
The ChatThreadsComponent......Page 337
The Single ChatThreadComponent......Page 338
ChatThreadComponent template......Page 340
The ChatWindowComponent......Page 341
The ChatMessageComponent......Page 351
The ChatMessageComponent template......Page 353
The ChatNavBarComponent @Component......Page 354
The ChatNavBarComponent template......Page 356
Summary......Page 357
Introduction to Redux with TypeScript......Page 359
Redux: Key Ideas......Page 360
What's a reducer?......Page 361
Creating Our First Reducer......Page 362
Running Our First Reducer......Page 363
Adjusting the Counter With actions......Page 364
Reducer switch......Page 365
Action ``Arguments''......Page 367
Storing Our State......Page 368
Being Notified with subscribe......Page 369
The Core of Redux......Page 373
Messaging App state......Page 374
Messaging App actions......Page 375
Messaging App reducer......Page 376
Trying Out Our Actions......Page 379
Action Creators......Page 380
Using Real Redux......Page 382
Using Redux in Angular......Page 384
Defining the Application State......Page 385
Defining the Reducers......Page 386
Creating the Store......Page 387
Providing the Store......Page 389
Bootstrapping the App......Page 390
imports......Page 391
The template......Page 392
The constructor......Page 393
Putting It All Together......Page 395
References......Page 396
Context For This Chapter......Page 398
Components......Page 399
Models......Page 400
Summary......Page 401
Thread......Page 402
Message......Page 403
A Word on Code Layout......Page 404
The UsersState......Page 405
The ThreadsState......Page 406
Visualizing Our AppState......Page 407
Set Current User Action Creators......Page 408
UsersReducer - Set Current User......Page 409
Adding a New Thread Action Creators......Page 410
Adding a New Thread Reducer......Page 411
Adding New Messages Action Creators......Page 412
Adding A New Message Reducer......Page 413
Selecting A Thread Action Creators......Page 415
Selecting A Thread Reducer......Page 416
Building the Angular Chat App......Page 417
The top-level AppComponent......Page 419
The ChatPage......Page 421
Container vs. Presentational Components......Page 422
Building the ChatNavBarComponent......Page 423
Redux Selectors......Page 425
Threads Selectors......Page 426
Unread Messages Count Selector......Page 427
Building the ChatThreadsComponent......Page 428
ChatThreadsComponent Controller......Page 429
ChatThreadsComponent template......Page 431
The Single ChatThreadComponent......Page 432
ChatThreadComponent template......Page 433
Building the ChatWindowComponent......Page 434
The ChatMessageComponent......Page 441
Setting incoming......Page 442
The ChatMessageComponent template......Page 443
Summary......Page 444
Styling......Page 446
View (Style) Encapsulation......Page 449
Shadow DOM Encapsulation......Page 453
No Encapsulation......Page 455
Popup Structure......Page 458
Using ElementRef......Page 460
Binding to the host......Page 462
Adding a Button using exportAs......Page 465
Creating a Message Pane with Content Projection......Page 467
Using ng-content......Page 468
Querying Neighbor Directives - Writing Tabs......Page 470
ContentTabComponent......Page 471
ContentTabsetComponent Component......Page 472
Using the ContentTabsetComponent......Page 474
Lifecycle Hooks......Page 476
OnInit and OnDestroy......Page 477
OnChanges......Page 481
DoCheck......Page 487
AfterContentInit, AfterViewInit, AfterContentChecked and AfterViewChecked......Page 500
Advanced Templates......Page 507
Rewriting ngIf - ngBookIf......Page 508
Rewriting ngFor - NgBookFor......Page 510
Change Detection......Page 516
Customizing Change Detection......Page 520
Zones......Page 527
Observables and OnPush......Page 528
Summary......Page 532
End-to-end vs. Unit Testing......Page 533
Jasmine......Page 534
Angular Unit testing framework......Page 535
Setting Up Testing......Page 536
Testing Services and HTTP......Page 538
Stubs......Page 539
Mocks......Page 540
TestBed.configureTestingModule and Providers......Page 541
Testing getTrack......Page 542
Creating a Router for Testing......Page 549
Mocking dependencies......Page 552
Spies......Page 553
Back to Testing Code......Page 555
fakeAsync and advance......Page 558
Testing ArtistComponent's Initialization......Page 559
Testing ArtistComponent Methods......Page 560
Testing ArtistComponent DOM Template Values......Page 562
Testing Forms......Page 564
Creating a ConsoleSpy......Page 567
Installing the ConsoleSpy......Page 568
Testing The Form......Page 569
Refactoring Our Form Test......Page 571
Testing a POST......Page 575
Testing DELETE......Page 578
Testing HTTP Headers......Page 579
Testing YouTubeSearchService......Page 581
Conclusion......Page 588
Peripheral Concepts......Page 589
What We're Building......Page 590
Mapping AngularJS 1 to Angular......Page 591
The AngularJS 1 App......Page 593
The ng1-app HTML......Page 595
ng1: PinsService......Page 596
ng1: Configuring Routes......Page 598
ng1: / HomeController template......Page 599
ng1: pin Directive template......Page 600
ng1: AddController......Page 602
ng1: AddController template......Page 604
Building A Hybrid......Page 607
Hybrid Project Structure......Page 608
Bootstrapping our Hybrid App......Page 610
What We'll Upgrade......Page 612
A Minor Detour: Typing Files......Page 615
Writing ng2 PinControlsComponent......Page 618
Using ng2 PinControlsComponent......Page 620
Downgrading ng2 PinControlsComponent to ng1......Page 621
Adding Pins with ng2......Page 623
Upgrading ng1 PinsService and $state to ng2......Page 624
Writing ng2 AddPinComponent......Page 625
Exposing an ng2 service to ng1......Page 631
Downgrade ng2 AnalyticsService to ng1......Page 632
Using AnalyticsService in ng1......Page 633
Summary......Page 634
References......Page 635
What is NativeScript?......Page 636
Where NativeScript Differs from Other Popular Frameworks......Page 637
What are the System and Development Requirements for NativeScript?......Page 638
Building and Testing for Android and iOS......Page 640
Installing JavaScript, Android, and iOS Plugins and Packages......Page 641
Planning the NativeScript Page Layout......Page 642
Adding UI Components to the Page......Page 644
Styling Components with CSS......Page 645
Developing a Geolocation Based Photo Application......Page 646
Creating a Fresh NativeScript Project......Page 647
Creating a Multiple Page Master-Detail Interface......Page 648
Creating a Flickr Service for Obtaining Photos and Data......Page 652
Creating a Service for Calculating Device Location and Distance......Page 657
Including Mapbox Functionality in the NativeScript Application......Page 661
Implementing the First Page of the Geolocation Application......Page 662
Implementing the Second Page of the Geolocation Application......Page 668
Try it out!......Page 669
NativeScript for Angular Developers......Page 670
Revision 63 - 2017-08-02......Page 671
Revision 59 - 2017-04-07......Page 672
Revision 54 - 2017-03-10......Page 673
Revision 49 - 2017-01-18......Page 674
Revision 43 - 2016-11-08......Page 675
Revision 38 - 2016-08-29......Page 676
Revision 32 - 2016-05-06......Page 677
Revision 28 - 2016-04-01......Page 678
Revision 23 - 2016-03-04......Page 679
Revision 17 - 2016-01-28......Page 680
Revision 14 - 2015-12-23......Page 681
Revision 11 - 2015-11-09......Page 682
Revision 9 - 2015-10-15......Page 683
Revision 4 - 2015-07-30......Page 684
Revision 1 - 2015-07-01......Page 685