Angular 2 handles services differently than Angular 1. We have already made most of the required changes to our code. Let's see what's left to be done.
- View Offline
- [Voiceover] Hi, and welcome to Section 4,…where we will make changes to our application…so that it becomes an Angular 2 application.…We are specifically going to upgrade our services…to Angular 2 first, then our directives.…We're also going to use a new Angular 2 component router,…introduce a new API and implement…Angular 2 HTML syntax changes.…Now we move on to the first video of this section,…where we're going to upgrade our services to Angular 2.…
First things first.…We are going to introduce the ngUpgrade package…along with the upgrade adapter,…which will allow us to mix Angular 1.x…and Angular 2 code during our migration process.…Then we're going to update our application so that it's…bootstrapped with UpgradeAdapter…before upgrading our service to Angular 2.…NgUpgrade and the UpgradeAdapter are tools developed…by the Angular team to facilitate the upgrade process.…What they do is allow us to mix code…from both versions of Angular…so that we can start writing some Angular 2 code…and make it work in our 1.x application.…
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