In Angular 4, you can easily update your web page title and meta tag information.
- Import the predefined meta service into your component.
import { Meta, Title } from '@angular/platform-browser';
- Enter Service in the Designer.
constructor(private title: Title, private meta: Meta) {}
- Add title and meta tag to ngOnInit () using setTitle and updateTag
ngOnInit(){ this.title.setTitle('Angular Overview'); this.meta.updateTag({ name:'author',content:'angulartpoint.com'}); this.meta.updateTag({name:'keyword',content:'angular overview, features'}); this.meta.updateTag({name:'description',content:'It contains overview of angular application'}); }
- Check the tag title in the browser.
enter image description here
Sachin dudhankar
source share