Add dynamic metadata to an Angular CLI Project
In this lesson we will create a
UiService and inside that service we create some application defaults, import the
Meta services from
@angular/platform-browser and create a function called
This function will set the metadata of the application based on the
We set some defaults and define a list with tags. We then loop over the tags and invoke the
updateTags method from the
Once our service is ready we update the
ProductDetailComponent to dynamically set the meta data by using the
tap operator in the
pipe from our Subscription.
After building and deploying the app we see that the meta data gets updated, and we can now share the app over Social Media and get rich social previews.