facebook

Best Practice to rename Angular component

  1. MyEclipse IDE
  2.  > 
  3. General Development
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #532809 Reply

    patidb
    Participant

    What is the right way to rename an Angular component/class/service so that the update propagates throughout code?

    #532872 Reply

    support-swapna
    Moderator

    patidb,

    You can rename any ts file or folder in an angular project by right clicking on the file in the Project Explorer view > Refactor > Rename. You will see the preview for “Rename Resource” and “Update TS Imports”.
    All the imports which refer to the renaming file will be listed in the dialog.

    We are working on improving the refactoring support for typescript files and add support to update the exported symbol names as well. We will keep you posted when the enhanced support for ts refactoring is out.

    If this is not what you are looking for, then please elaborate how exactly you want the Rename in angular projects to work and we will see if we can work on it.

    –Swapna
    MyEclipse Support

    #532878 Reply

    support-swapna
    Moderator

    patidb,

    You can also rename the component references from within the files that reference them. This will update all the references but will leave the file names or folder names as it is. To rename file names and folder names, you can follow the steps mentioned in my previous response.

    For example, if the app.module.ts references a component as : import { TestComponent } from './test/test.component'; then you can open the app.module.ts file in the editor, place the cursor in the component name “TestComponent” and right click. Select Rename. You can rename it and pull down the hover box for a Preview selection to see what would be changed. Attached is the screenshot for your reference.

    Hope this helps. Please let us know if you have any questions.

    –Swapna
    MyEclipse Support

    Attachments:
    You must be logged in to view attached files.
Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Best Practice to rename Angular component

You must be logged in to post in the forum log in