Take a look at the following dynamic route:
export const routes: Routes = [
{
path: 'template/:templateId',
component: TemplateComponent,
data: { pageTitle: 'TEMPLATES'}
}]
Can we dynamically change the pageTitle for the same route and component?
- For instance:
- If the URL is 'template/01', I want to set the pageTitle in data as 'TEMPLATES-01'.
- If the URL is 'template/02', I want to set the pageTitle in data as 'TEMPLATES-02'.
In this case, the path remains constant as 'template/:templateId', and the component also stays as 'TemplateComponent', but the URLs vary between 'template/01' and 'template/02'.