Reputation: 49
My App is connected withe the GTM (Google Tag Manager). I want to see all page views from the users, but i only see the Ionic App. the title in the index.html is static, but can i do this dynamic?
Upvotes: 1
Views: 682
Reputation: 985
In your app.component.ts
file import Title
class from @angular/platform-browser
and add it in the constructor. Then add the code mentioned below
ngOnInit() {
this.router.events
.pipe(filter((event) => event instanceof NavigationEnd))
.subscribe((event: any) => {
const title = event.url;
this._title.setTitle(`${title}`);
});
}
This way, you will be able to change the title of your index.html
file.
Upvotes: 3