routing home + details

This commit is contained in:
HarmandI 2021-12-15 16:10:58 +01:00
parent 0548c870bb
commit 4a4502bdfd
16 changed files with 142 additions and 4 deletions

View File

@ -1,7 +1,12 @@
import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
import { PageDetailsComponent } from './pages/page-details/page-details.component';
const routes: Routes = [];
const routes: Routes = [
{path:'home', component: PageAccueilComponent},
{path : 'details', component: PageDetailsComponent}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],

View File

@ -4,11 +4,18 @@ import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NavBarComponent } from './components/nav-bar/nav-bar.component';
import { PageAccueilComponent } from './pages/page-accueil/page-accueil.component';
import { PageDetailsComponent } from './pages/page-details/page-details.component';
import { PageNotFoundComponent } from './pages/page-not-found/page-not-found.component';
@NgModule({
declarations: [
AppComponent,
NavBarComponent
NavBarComponent,
PageAccueilComponent,
PageDetailsComponent,
PageNotFoundComponent,
],
imports: [
BrowserModule,

View File

@ -12,8 +12,8 @@
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link">Accueil</a>
<a class="nav-link">Details</a>
<a routerLink = "home" routerLinkActive="active-custom" class="nav-link">Accueil</a>
<a routerLink = "details" routerLinkActive="active-custom" class="nav-link">Details</a>
<a class="nav-link">Panier</a>
<a class="nav-link disabled">Plus d'option bientôt</a>
</div>

View File

@ -0,0 +1,3 @@
.active-custom{
color: green !important;
}

View File

@ -0,0 +1 @@
<p>page-accueil works!</p>

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageAccueilComponent } from './page-accueil.component';
describe('PageAccueilComponent', () => {
let component: PageAccueilComponent;
let fixture: ComponentFixture<PageAccueilComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageAccueilComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageAccueilComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-accueil',
templateUrl: './page-accueil.component.html',
styleUrls: ['./page-accueil.component.scss']
})
export class PageAccueilComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -0,0 +1 @@
<p>page-details works!</p>

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageDetailsComponent } from './page-details.component';
describe('PageDetailsComponent', () => {
let component: PageDetailsComponent;
let fixture: ComponentFixture<PageDetailsComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageDetailsComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageDetailsComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-details',
templateUrl: './page-details.component.html',
styleUrls: ['./page-details.component.scss']
})
export class PageDetailsComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}

View File

@ -0,0 +1 @@
<p>page-not-found works!</p>

View File

@ -0,0 +1,25 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { PageNotFoundComponent } from './page-not-found.component';
describe('PageNotFoundComponent', () => {
let component: PageNotFoundComponent;
let fixture: ComponentFixture<PageNotFoundComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ PageNotFoundComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(PageNotFoundComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View File

@ -0,0 +1,15 @@
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-page-not-found',
templateUrl: './page-not-found.component.html',
styleUrls: ['./page-not-found.component.scss']
})
export class PageNotFoundComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}