add component in angular router
JavaScript
First you need to make component using 'ng generate'
$ ng generate component home
$ ng generate component about
Next, in the src/app/app-routing.module.ts file import the components as follows:
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
Next, add the routes as follows:
const routes: Routes = [
{ path: 'home', component: HomeComponent },
{ path: 'about', component: AboutComponent }
];
So now if you visit the /home path you should go to home component and if you visit the /about path you should go to the about component.
/*
I hope it will help you.
Namaste
Stay Home Stay Safe
*/
Also in JavaScript:
- Title
- clear the console while in strict mode
- Category
- JavaScript
- Title
- Array Helpers
- Category
- JavaScript
- Title
- abstraction in javascript
- Category
- JavaScript
- Title
- how to write a program that determines the minutes since midnight, Jan 1, 1970 in javascript
- Category
- JavaScript
- Title
- how to get today date in javascript
- Category
- JavaScript
- Title
- express server replit
- Category
- JavaScript
- Title
- How to check whether a string contains a substring in JavaScript?
- Category
- JavaScript
- Title
- angular component lifecycle hooks
- Category
- JavaScript
- Title
- how to update jquery datatable row cell value
- Category
- JavaScript
- Title
- deploy angular app on google app engine
- Category
- JavaScript
- Title
- Date gethours js
- Category
- JavaScript
- Title
- delete node between indexes node list js
- Category
- JavaScript
- Title
- file input disable open file picker javascript
- Category
- JavaScript
- Title
- how to learn javascript
- Category
- JavaScript
- Title
- emmet jsx visual studio
- Category
- JavaScript
- Title
- google sign in in firebase react
- Category
- JavaScript
- Title
- href before onclick js
- Category
- JavaScript
- Title
- ERROR in ./src/app/pages/auth/auth.module.ngfactory.js Module not found: Error: Can't resolve '@angular/material/core/index'
- Category
- JavaScript
- Title
- export apk react native
- Category
- JavaScript
- Title
- import json file javascript
- Category
- JavaScript
- Title
- check if string is datestring javascript
- Category
- JavaScript
- Title
- fetch post js
- Category
- JavaScript
- Title
- ERROR in ./node_modules/tns-core-modules/ui/core/view/view.js Module not found: Error: Can't resolve '@nativescript/core/ui/core/view/view' in '/home/deepali/projects/supersquad-client/node_modules/tns-core-modules/ui/core/view'
- Category
- JavaScript
- Title
- how to get user ip address in javascript
- Category
- JavaScript
- Title
- 'Link' is not defined react/jsx-no-undef
- Category
- JavaScript
- Title
- convert a int to a unicode javascript
- Category
- JavaScript
- Title
- how to convert array to uppercase in javascript
- Category
- JavaScript
- Title
- fizzbuzz js
- Category
- JavaScript
- Title
- app script append two list
- Category
- JavaScript
- Title
- javascript exercism.io bob solution
- Category
- JavaScript
- Title
- how to instal jquery with npm
- Category
- JavaScript
- Title
- how to append select option in jquery
- Category
- JavaScript
- Title
- if clicked outside of div jquery
- Category
- JavaScript
- Title
- Add object to array javascript
- Category
- JavaScript
- Title
- flutter vs react native
- Category
- JavaScript
- Title
- inline z-index react
- Category
- JavaScript
- Title
- eval in js
- Category
- JavaScript
- Title
- how to substract date object javascript
- Category
- JavaScript
- Title
- how to make fake binary
- Category
- JavaScript
- Title
- app listen with all error handling
- Category
- JavaScript
- Title
- combine two arrays javascript
- Category
- JavaScript
- Title
- html decode javascript
- Category
- JavaScript
- Title
- angular npm angular material
- Category
- JavaScript
- Title
- how to make a div scrollable
- Category
- JavaScript
- Title
- javascript ascending and descending
- Category
- JavaScript
- Title
- how to parse header in node.js lambda
- Category
- JavaScript
- Title
- get the index of object in array
- Category
- JavaScript
- Title
- Angular watching for changes in $http.pendingRequests from directive
- Category
- JavaScript
- Title
- how to know if a number has a decimal number js
- Category
- JavaScript
- Title
- ad data to js object
- Category
- JavaScript
- Title
- how to make a page relode on a keypress in js
- Category
- JavaScript
- Title
- bookshelf insert multiple rows
- Category
- JavaScript
- Title
- javascript Check if an element is a descendant of another
- Category
- JavaScript
- Title
- javascript array flat
- Category
- JavaScript
- Title
- How to create a nested schema in apollo graphql server
- Category
- JavaScript
- Title
- devexpress dxdatagrid custom text field link
- Category
- JavaScript
- Title
- defineCall is not a function at Sequelize.import sequelize.js
- Category
- JavaScript
- Title
- how to push multiple data to different parents in a single request in firebase
- Category
- JavaScript
- Title
- how to use style in react js
- Category
- JavaScript
- Title
- Error: Can't resolve 'fs' webpack
- Category
- JavaScript
- Title
- angular submit form programmatically
- Category
- JavaScript
- Title
- export aab react native
- Category
- JavaScript
- Title
- firebase app named default already exists react native
- Category
- JavaScript
- Title
- how to freeze js object
- Category
- JavaScript
- Title
- get date javascript
- Category
- JavaScript
- Title
- get the size of the browser jquery
- Category
- JavaScript
- Title
- get react version
- Category
- JavaScript
- Title
- add table row jQuery
- Category
- JavaScript
- Title
- how to push array
- Category
- JavaScript
- Title
- how to push values in array
- Category
- JavaScript
- Title
- google maps api javascript
- Category
- JavaScript
- Title
- add new items in a select input using js
- Category
- JavaScript
- Title
- const{}=
- Category
- JavaScript
- Title
- create react app theme_color
- Category
- JavaScript
- Title
- how to get the size of the window in javascript
- Category
- JavaScript
- Title
- how to draw a triangle using javascript
- Category
- JavaScript
- Title
- how to add role in discord.js v12
- Category
- JavaScript
- Title
- devexpress dxdatagrid custom text field
- Category
- JavaScript
- Title
- how to align text inside react component
- Category
- JavaScript
- Title
- add element to body javascript
- Category
- JavaScript
- Title
- convert array object to string javascript
- Category
- JavaScript
- Title
- how to access array datat in class component react
- Category
- JavaScript
- Title
- get current screen name react navigation
- Category
- JavaScript
- Title
- accept 2 values after decimal in angular forms
- Category
- JavaScript
- Title
- fizz buzz javascript
- Category
- JavaScript
- Title
- check if localstorage key exists js
- Category
- JavaScript
- Title
- how to add object to array javascript
- Category
- JavaScript
- Title
- foreach w3schools javascript
- Category
- JavaScript
- Title
- how to create uuid in javascript
- Category
- JavaScript
- Title
- how to make a animation in javascript stack overflow
- Category
- JavaScript
- Title
- addEnd Point js
- Category
- JavaScript
- Title
- how to build a string javascript es6
- Category
- JavaScript
- Title
- create a form and submit it dynamically jquery
- Category
- JavaScript
- Title
- how to get value in array object value using for loop in javascript
- Category
- JavaScript
- Title
- Elements in iteration expect to have 'v-bind:key' directives
- Category
- JavaScript
- Title
- basic javascript
- Category
- JavaScript
- Title
- compare dates in javascript
- Category
- JavaScript
- Title
- how to add variable to local storage in javascript
- Category
- JavaScript
- Title
- ISS proxy express
- Category
- JavaScript
- Title
- How to append to a file in Node?
- Category
- JavaScript