Angular 2 handles scopes differently compared to Angular 1. That change of philosophy was already introduced in Angular 1 with the "controllerAs" syntax.
- [Narrator] Hi and welcome to section three,…Getting Your Angular 1.x Application Ready for Angular 2.…In the previous section, we learned that Angular 2…is designed to work alongside Angular 1…and the migration can be done incrementally.…In this section, we will make changes to our application…so that we its code as close as possible…to the Angular 2 syntax.…We are specifically going to clean up our scopes…by using the controllerAs syntax,…which is a variable in Angular 1,…and is much closer to the way scopes…are handled in Angular 2.…
We're also going to use more directives…instead of controllers,…use the new component router,…and use TypeScript in as many places as possible,…so that we'll only have minor changes left to be done…when we finally migrate our application to Angular 2.…Now we move on to the first video of this section…where we're going to understand why it's important…to clean up our scopes before actually doing it.…First thing is first,…we are going to introduce the controllerAs syntax,…and explain why it makes sense…
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