ng-book2,媲美官方的angular2实用教程
国外关于angular2的教程,比官方的教程更加通俗易懂和容易学习,该教程配套的代码也会上传,欢迎大家搜索下载,因为费了不少心思才找到,所以会设置积分,谢谢大家理解。We'd like to thank:Our technical editor frode fikkeNic Raboy, and Burke Holland for contributing the Native Script chapterContentsBook RevisionBug reportsChat with The communityBe notified of updates via TwitterWe'd love to hear from you!Writing your First Angular 2 Web ApplicationSimple reddit cloneGetting started4TypeScript4angular-cliExample projectWriting Application CodeRunning the applicationMaking a Component10Importing Dependencies12Component Annotations12Adding a template with templateUrl13Adding a template13Adding CSS Styles with styleUrls14Loading Our ComponentAdding Data to the Component16Working With Arrays19USing the User Item ComponentRendering the UserItemComponent23Accepting Inputs24Passing an Input valueBootstrapping Crash Course26Expanding our Application28Adding CssThe Application ComponentAdding Interaction32Adding the Article Component36Rendering multiple rows45CONTENTSCreating an Article class45Storing Multiple Articles50Configuring the ArticleComponent with inputs51Rendering a List of Articles52Adding New Articles54Finishing TouchesDisplaying the article domain55Re-sorting Based on Score56Full Code listing57ing u57Getting HelpTypescript58Angular 2 is built in TypeScript58What do we get with TypeScript?peTrying it out with a rePlBuilt-in types62Classes番64Properties64Methods65ConstructorsInheritance68Fat arrow FunctionsTemplate Strings72Wrapping upHow Ansularorks74Application74The Navigation ComponentThe Breadcrumbs Component75The Product list Component76Product model78ComponentsComponent Annotation81Component selector81Component template82Adding A Product82Viewing the Product with Template Binding84Adding More Products85ting a product86Listing products using < products-list>86CONTENTSThe ProductsList ComponentConfiguring the ProductsList (Component OptionsComponent inputs90Component outputs93Emitting Custom Events95Writing the ProductsList Controller Class96Writing the productslist View Template97The Full ProductsL ist ComponentThe ProductRow Component101ProductRow Component Configuration101ProductRow Component Definition Class102ProductRow template103ProductRow Full Listing103The Product Image component104The PriceDisplay Component105The Product Department Component105NgModule and Booting the App106Booting the108The Completed project,108A Word on data architectuBuilt-in directives110Introduction110NgI fNgSwitcl110Nasty113Ngclass115NgOr118Getting an index.123NgNonBindab l124Conclusion125Forms in Angular 2126Forms are Crucial, Forms are Complex126FormControls and FormGroups126FormControl126127Our first form128ding the FormsModul129Simple sKU Form:@Component Annotation130Simple sKu Form: templateSimple sku Form: Component Definition Class134Try it out.134CONTENTSUsing formBuilder136Reactive Forms with FormBuilder137Using FormBuilder137Using myForm in the view138Try itryout139Adding validations,,,,,,,140Explicitly setting the sku FormControl as an instance variable142Custom validations147Watching For Changes148ngmodel150152Http153Introduction153Using @angular/ htt154importfrom@angular/http154a Basic request155BuildingtheSimplehttpcomponentComPOnent156BuildingtheSimplehttpcomponenttemplate156BuildingtheSimplehttpcomponentController157Fullsimplehttpcomponent159Writing a YouTube SearchComponent160Writing a SearchResult162Writing the YouTubeService162ng the sea171Writing SearchResultComponent178Writing YouTube SearchComponent179angular/httpapl.............183Making a poST request183PUT/ PATCH/DELETE/HEAD183Requestoptions184Summary185Routing·186Why Do We Need Routing186How client-side routing works187The beginning: using anchor tags188The evolution html5 client-side routing188Writing our first routes.189Components of Angular 2 routingImports189Rout190Installing our Routes191CONTENTSRouteroutlet using 192RouterLink using [routerLink193Putting it all together194Creating the Components196Home Component·196AboutComponent196Contactcomponent196Application Component197Configuring the routes199Routing strategies200Path location strategy201Running the application202Route parameters204ActivatedrouteMusic Search App206First Steps208The SpotifyService209The SearchComponent210Trrying the search·220TrackComponent222rapping up music search224Router hooks.,,,,,,,,,,,,,,,,,,,224Auth Seryice225LoginComponent226ProtectedComponent and Route guards228Nested routes234Configuring Routes235Productscomponent235umma240Dependency Injection241Injections Example: PriceService242Dont call us244Dependency Injection Parts.246Playing with an Injector,247Providing dependencies with NgModule249Providers250Using a class250Using a Factory,,251Using a Vue.,,.253Using an alias253Dependency Injection in Apps253Working with Injectors255CONTENTSSubstituting values...........262NgModule266NgModule vs JavaScript modules,,,266The Compiler and Components267Dependency Injection and Providers ..................267Component visibility,,268Specifying Providers270Conclusion271Data Architecture in Angular 2272An Overview of data architecture272Data architecture in Angular 2273Data architecture with observables- Part 1: Services27生Observables and rx]sNote: Some rxJS Knowledge Required…·274274Learning Reactive Programming and rxJS274Chat App overview,276Components277Models278Services279Summary..,279Implementingthe models280ser280Thread280essage281Implementing UserServicecurrentUser stream282Setting a new user28User service. ts284The Messages Service285the new Messages stream285the messages streamThe operation Stream Pattern287Sharing the streamAdding messages to the messages streamOur completed MessagesService293Trying out Messages ServiceThe threads service98A map of the current set of Threads(in threads)298A chronological list of Threads, newest-first (in orderedthreads)The currently selected Thread(in currentThread)303The list of Messages for the currently selected Thread(in currentThreadMessages305CONTENTSOur Completed ThreadsService,308Data Model Summary310Data Architecture with Observables- Part 2: View Components311Building Our Views: The ChatApp Top-Level Component311The ChatThreads Component,314ChatThreads Controller314ChatThreads template315The Single Chat Thread Component,316ChatThread Controller and ngOnInit,,317ChatThread templat318Chat Thread Complete Code319The Chatwindow Component320The ChatMessage Component330Setting incoming331The Chat Message template332The Complete ChatMessage Code listing333The ChatNavBar Component338The ChatNav Bar @Component338The ChatNavBar Controller338The ChatNavBar template340The Completed ChatNavBar340Summary342Next steps343Introduction to Redux with TypeScript344Redux345Redux: Key ideasCore redux ideasWhat's a reducer?346Defining Action and Reducer Interfaces347Creating Our First Reducer348Running our first Reducer,348Adjusting the Counter With actions349Reducer switchAction“ Argume/,…350,352Storing our statesing the354Being Notified with subscribe354The Core of redux358A Messaging App359iging App state359Messaging App actions.360
用户评论