Angular 2 has a new router based on components. Using this router is the final step before we have our app fully migrated to Angular 2.
- [Instructor] Hi and welcome to video 4.4…where we are about to use the new…Angular 2 component router.…At the end of this video our app will…be fully migrated to Angular 2.…We're also specifically going to add some…code to configure our component router.…Then we're going to bootstrap our app with…Angular 2 instead of Angular 1.…Finally, we'll be able to remove all Angular 1…dependencies and have a fully functional…Angular 2 application.…Let's get started by opening app.module.ts…First we have to create a new component here,…which should be our main component to…bootstrap our new application.…
The selector here will play the role of the…anti-app attribute in Angular 1,…which means it will serve as a bootstrap point…for our application.…Specifying our template as router-outlet…is the equivalent of the Angular 1 ng-view directive,…meaning that this is where the main view will…load our components based on current url.…Then we have our actual router config,…which is another rotation with contents…that are very similar to our Angular 1 config.…
Angular 2 is a technical and conceptual overhaul of its hugely popular predecessor, AngularJS. To stay ahead, developers who have built and maintained projects with AngularJS need to be able to transition them to Angular 2. Migrating to Angular 2 demonstrates how to create and execute an effective migration plan for Angular applications. It opens with an introduction to the major changes and additions brought by the new framework. Then author Alain Chautard reviews a plan to migrate a sample weather application from its original Angular 1.x codebase.
Learn how to migrate blocks of code incrementally, as opposed to porting code in bulk, and get a brief introduction to TypeScript and ECMAScript 6. Along the way, Alain shows you how to gradually deprecate $scope, upgrade services, work with the component router, transition forms, and more.
By the end of this course, you'll be up to speed with the fundamental building blocks of Angular 2 development, and fully capable (and confident) transitioning existing Angular 1.x projects to the new environment, ready to explore everything that Angular 2 has to offer.
- What's new in Angular 2?
- Migrating incrementally
- What are TypeScript and ES6?
- Cleaning up $scopes
- Making components
- Using TypeScript classes
- Upgrading 1.x services, components, and controllers
- Best practices for Angular 2