Roadmap from AngularJS to Angular
It is good to follow this roadmap in migrating AngularJS to Angular:
- JavaScript to TypeScript
- Installing Angular packages
- Creating the AppModule
- Bootstrapping your application
- Upgrading your application service
- Upgrading your application component
- Adding the Angular router
Let us discuss them in detail in the following sections.
JavaScript to TypeScript
Start your migration process by introducing TypeScript, as you will be writing your code using TypeScript in Angular. Installing TypeScript into your Angular application is quite easy. Run the following command to install TypeScript from npm
into your application and save the package information to package.json
:
npm i typescript --save-dev
Note
Note: As the Angular package is only available on npm, we will be installing any new packages from npm and we will slowly phase out from the Bower package manager
We also need to configure TypeScript, instructing it on transpiling the TypeScript code into ES5 code in the tsconfig...