Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (angular 8 project user component routing) Part 11
Angular 8 project user component routing
In this tutorial we will cover angular 8 project user component routing .In the previous tutorial, we created related components from the user section and global navigation.
you can use following step for angular project routeing
- Create important component for required your angular 8 project
- open app-routing.module.ts file
- import all components on app-routing.module.ts file
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ExampleComponent } from './example/example.component';/*Project Related Component */
import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { ContactComponent } from './contact/contact.component';
import { AuthenticationComponent } from './authentication/authentication.component';
import { RoomBookingRequestComponent } from './room-booking-request/room-booking-request.component';
import { FeedbackComp2onent } from './feedback/feedback.component';const routes: Routes = [
{'path':'example','component':ExampleComponent},
];@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
4. create routeing
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ExampleComponent } from './example/example.component';import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { ContactComponent } from './contact/contact.component';
import { AuthenticationComponent } from './authentication/authentication.component';
import { RoomBookingRequestComponent } from './room-booking-request/room-booking-request.component';
import { FeedbackComponent } from './feedback/feedback.component';const routes: Routes = [
{'path':'example','component':ExampleComponent},
/* Project Routeing */
{'path':'','component':HomeComponent},
{'path':'about','component':AboutComponent},
{'path':'contact','component':ContactComponent},
{'path':'auth','component':AuthenticationComponent},
{'path':'room-booking-request','component':RoomBookingRequestComponent},
{'path':'feedback','component':FeedbackComponent},
];@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
5. Link routeing on global navigation
6. open app.component.html
<nav class="navbar navbar-expand-sm navbar-dark bg-dark mb-3">
<div class="container">
<a class="navbar-brand" routerLink="/">HMS</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" routerLink="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/contact">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/room-booking-request">Room Booking</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/feedback">Feedback</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/auth">Login</a>
</li>
</ul>
</div>
</nav>
Complete Code
app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ExampleComponent } from './example/example.component';import { HomeComponent } from './home/home.component';
import { AboutComponent } from './about/about.component';
import { ContactComponent } from './contact/contact.component';
import { AuthenticationComponent } from './authentication/authentication.component';
import { RoomBookingRequestComponent } from './room-booking-request/room-booking-request.component';
import { FeedbackComponent } from './feedback/feedback.component';const routes: Routes = [
{'path':'example','component':ExampleComponent},{'path':'','component':HomeComponent},
{'path':'about','component':AboutComponent},
{'path':'contact','component':ContactComponent},
{'path':'auth','component':AuthenticationComponent},
{'path':'room-booking-request','component':RoomBookingRequestComponent},
{'path':'feedback','component':FeedbackComponent},
];@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule { }
app.component.html
<nav class="navbar navbar-expand-sm navbar-dark bg-dark mb-3">
<div class="container">
<a class="navbar-brand" routerLink="/">HMS</a>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" routerLink="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/contact">Contact</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/room-booking-request">Room Booking</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/feedback">Feedback</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/auth">Login</a>
</li>
</ul>
</div>
</nav>
<div class="page_container">
<router-outlet></router-outlet>
</div>
<div class="footer">
<div class="row">
<div class="col-sm-4 subscribe_box">
<p class="footer_text">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s</p>
<h4 class="footer_text">For Letest Update Subscribe Now</h4>
<input type="email" name="email" class="form-control" placeholder="E-Mail" />
</div>
<div class="col-sm-4">
<h4 class="text-center mt-4 mb-4 footer_text">Contact Information</h4>
<table>
<tr>
<td class="contect_tab footer_text">E-Mail</td>
<td class="contect_tab footer_text">example@gmail.com</td>
</tr>
<tr>
<td class="contect_tab footer_text">Mobile No</td>
<td class="contect_tab footer_text">999999999</td>
</tr>
<tr>
<td class="contect_tab footer_text">Address</td>
<td class="contect_tab footer_text">Your Address</td>
</tr>
</table>
</div>
<div class="col-sm-4">C</div>
</div>
</div>
Tutorial Topics
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (Angular 8 Project Tutorial Environment Setup ) Part 1
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (How to install bootstrap in angular 8 project)
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (how to install laravel project on localhost ) Part 3
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel | Overview part 4
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (Angular 8 project folder structure) Part 5
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (laravel project folder structure) Part 6
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (Remove public on laravel project URL) Part 7
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (What is component in angular project ) Part 8
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (create user section related component in angular ) Part 9
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (global navigation and footer setup in angular 8 project) Part 10
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (angular 8 project user component routing) Part 11
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (footer section social link angular 8 project ) Part 12
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (home page bootstrap slider setup angular 8 project ) Part 13
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (home page bootstrap slider setup angular 8 project ) Part 14
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (home page service section angular 8 project ) Part 15
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (home page service section angular 8 project ) Part 16
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (laravel project environment setup for web api (web service) ) Part 17
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (model and migration creation and api server side validation in laravel for contect form) Part 18
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (contact form api in laravel ) Part 19
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (contact form api | laravel api calling from angular 8 project ) Part 20
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (contact form api | laravel api calling from angular 8 project ) Part 21
- Angular Projects For Beginners With Laravel | Hotel Management System project with angular 8 and Laravel (contact form api | laravel api calling from angular 8 project ) Part 21