step 10
This commit is contained in:
@@ -1,8 +1,7 @@
|
|||||||
<main>
|
<main><a [routerLink]="['/']">
|
||||||
<header class="brand-name">
|
<header class="brand-name"><img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true"/></header>
|
||||||
<img class="brand-logo" src="/assets/logo.svg" alt="logo" aria-hidden="true" />
|
</a>
|
||||||
</header>
|
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<app-home></app-home>
|
<router-outlet></router-outlet>
|
||||||
</section>
|
</section>
|
||||||
</main>
|
</main>
|
||||||
@@ -1,12 +1,13 @@
|
|||||||
import {Component} from '@angular/core';
|
import {Component} from '@angular/core';
|
||||||
import {Home} from './home/home';
|
import {Home} from './home/home';
|
||||||
|
import {RouterModule} from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
imports: [Home],
|
imports: [Home, RouterModule],
|
||||||
templateUrl: './app.html',
|
templateUrl: './app.html',
|
||||||
styleUrls: ['./app.css'],
|
styleUrls: ['./app.css'],
|
||||||
})
|
})
|
||||||
export class App {
|
export class App {
|
||||||
title = 'homes';
|
title = 'homes';
|
||||||
}
|
}
|
||||||
|
|||||||
15
first-app/src/app/details/details.ts
Normal file
15
first-app/src/app/details/details.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-details',
|
||||||
|
imports: [],
|
||||||
|
template: `
|
||||||
|
<p>
|
||||||
|
details works!
|
||||||
|
</p>
|
||||||
|
`,
|
||||||
|
styles: ``
|
||||||
|
})
|
||||||
|
export class Details {
|
||||||
|
|
||||||
|
}
|
||||||
17
first-app/src/app/routes.ts
Normal file
17
first-app/src/app/routes.ts
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
import {Routes} from '@angular/router';
|
||||||
|
import {Home} from './home/home';
|
||||||
|
import {Details} from './details/details';
|
||||||
|
|
||||||
|
const routeConfig: Routes = [
|
||||||
|
{
|
||||||
|
path: '',
|
||||||
|
component: Home,
|
||||||
|
title: 'Home page',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: 'details/:id',
|
||||||
|
component: Details,
|
||||||
|
title: 'Home details',
|
||||||
|
},
|
||||||
|
];
|
||||||
|
export default routeConfig;
|
||||||
@@ -4,7 +4,8 @@
|
|||||||
*/
|
*/
|
||||||
import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser';
|
import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser';
|
||||||
import {App} from './app/app';
|
import {App} from './app/app';
|
||||||
|
import {provideRouter} from '@angular/router';
|
||||||
bootstrapApplication(App, {providers: [provideProtractorTestingSupport()]}).catch((err) =>
|
import routeConfig from './app/routes';
|
||||||
console.error(err),
|
bootstrapApplication(App, {
|
||||||
);
|
providers: [provideProtractorTestingSupport(), provideRouter(routeConfig)],
|
||||||
|
}).catch((err) => console.error(err));
|
||||||
Reference in New Issue
Block a user