Migrate existing angular project to standalone

1k views Asked by At

my angular project was on version 13 and I migrated it step by step to angular 16. now I want to make it fully standalone and then migrate it to version 17.

Is there any utility that I can use or do I have to do it manually?

1

There are 1 answers

1
Mahdi Zarei On BEST ANSWER

You can migrate your angular project to standalone with this command:

ng generate @angular/core:standalone

As the docs say:

Run the migration in the order listed below, verifying that your code builds and runs between each step:

  1. Run ng g @angular/core:standalone and select Convert all components, directives and pipes to standalone
  2. Run ng g @angular/core:standalone and select Remove unnecessary NgModule classes
  3. Run ng g @angular/core:standalone and select Bootstrap the project using standalone APIs
  4. Run any linting and formatting checks, fix any failures, and commit the result

In my case, there was no error after the migration but in your case, they may occur and you need to fix them manually.

As the last step, you need to remove all the remaining modules manually from your project as they are useless now.