angulartypescriptangular-standalone-componentsangular-migration

Migrate existing angular project to standalone


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?


Solution

  • 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.