Adding/Deleting Menu & Component
Vuely Angular lets you add the new component in the existing template, Please follow the detailed documentation to learn about adding new components.
Last updated
Vuely Angular lets you add the new component in the existing template, Please follow the detailed documentation to learn about adding new components.
Last updated
We will help you in creating a new component. Follow the steps below to add a new component. We will add a test component in the template:
Step 1: Open the src->app
folder in the terminal or command prompt & run the following command:
It will create a module & its routing file inside the test folder.
Step 2: Now run the following command in the same app folder like you did in the above step
It will create the test1 component in the test folder. After completing these two steps, when you will open the test folder, It will looks like:
It contains the module, its routing file & the component folder.
Step 3: Now open the test-routing.module.ts
file to add the route of the newly created component test1
. You need to import the component and then define the path of the component. Like given in the example below:
Step 4: Open the src->app->app-routing.ts
file and add the route of the test module in the children array. See the code below for the reference:
Step 5: Now add this component in the sidebar menu. Open the src->app->Core->MenuItems->MenuItems.ts
file and add the component in the MENUITEMS
array. Like we have added in the below example:
Now you have completed all the steps of adding the component in the template & the sidebar menu. Save the file and open the browser, you will see your newly added component in the sidebar. Have a look at the screenshot below to check how your component is added in the template:
We will help you in deleting a menu & its component from the menu list by listing down the steps needed to delete. Please follow the steps described below, We will take an example by deleting the test1 component & TEST menu from the menu list which we have created in the above part:
Step 1: Firstly, open the src->app->test->test.module.ts
file and remove the test1
component import statement
& its declaration from the declarations
array in the file. Like we have removed the commented lines from the given code example.
Step 2: Now open the src->app->test->test-routing.module.ts
file and remove the import statement
of test1
component & its route from the routes
array. Like we have removed the commented lines from the given code example.
Step 3: Now delete the test1
component folder manually from the src->app->test
folder.
Step 4: Open the src->app->Core->MenuItems->MenuItems.ts
file and remove the component from the MENUITEMS
array. Like we have removed the commented lines from the given code example.
That's it, now you have completed all the steps to delete a menu from the menu list and its component from the app. Save the file and open the browser, now you will see that your template does not contains your deleted component anymore.