Angular 4 how to set page title -
i want set dynamic page title every time clicked route.
app.route.ts
export const routes: routes = [ { path: '', component: logincomponent, data: { title: 'login' } }, ];
in root index.html have this.
<!doctype html> <html> <head> <base href="./"> <title>{{ title }}</title> </head> <body class="app"> <!-- app loading app injects in body... --> </body> </html>
login component import { component, oninit } '@angular/core';
@component({ selector: 'app-login', templateurl: './login.component.html', styleurls: ['./login.component.scss'] }) export class logincomponent implements oninit { constructor() { } ngoninit() { } }
i'm not sure if title names call in component or not. if needs called how do that?
i'm using angular4 has different ways things. duplicate answer using messy workaround 2 years ago.
Comments
Post a Comment