Saturday, December 22, 2018

Convert Angular JS application to Angular 2 application


  1. Each AngularJS module to respective Angular module.
  2. Element type directive to a Component.
  3. Attribute type directive with a template to a Component.
  4. Attribute type directive without a template to a Directive.
  5. Find the set of controllers and templates in your routes and convert each of them to a component. If two different templates use the same controller, you must create two different components corresponding to each of the templates. 
  6. Make sure to move common business logic to an Injectable (aka service) to improve code reusability.
  7. Convert a factory or a service to an Injectable (aka services)
  8. Convert a provider too to an Injectable but using useFactory 
  9. Convert a filter to a Pipe.
  10. Write all your run block code in a callback by chaining on the bootstrap method call of main.ts file. Example:

No comments:

Followers

Link