https://github.com/blaugold/angular-browser-meta
Docs ->
https://github.com/blaugold/angular-browser-meta
Last synced: 3 months ago
JSON representation
Docs ->
- Host: GitHub
- URL: https://github.com/blaugold/angular-browser-meta
- Owner: blaugold
- Created: 2016-11-28T15:52:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-11T17:52:16.000Z (about 9 years ago)
- Last Synced: 2025-10-31T14:18:12.310Z (7 months ago)
- Language: TypeScript
- Homepage: https://blaugold.github.io/angular-browser-meta/
- Size: 361 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## Angular Browser Meta
This module sets Meta Tags and Title from the data property of Routers ActivatedRoute.
Updates happen when data or the route changes.
Overrides are possible by injecting the `MetaTagService` or `TitleService` in components or other
services.
## Installation
```
npm i --save angular-browser-meta
```
## Usage
```typescript
import { NgModule, Component } from '@angular/core'
import { TitleModule, MetaTagModule, MetaTagService } from 'angular-browser-meta'
@NgModule({
imports: [
TitleModule.forRoot({ defaultTitle: 'Your App' }),
MetaTagModule.forRoot(),
]
})
export class AppModule {}
@Component({ template: '' })
export class AppComponent {
constructor(metaTagService: MetaTagService) {
// You can override the data from routes.
// Updates from data resolvers will not reset overrides but navigation will.
metaTagService.set('author', 'Bob');
}
}
const route = {
// If data from a resolver changes tags will be updated.
data: {
title: 'Page Title', // => Title is set to "Page Title | Your App",
meta: {
// Meta tags with name attribute.
name: {
// Values are used to set the content prop on a meta element which should be a string.
keywords: ['Awesome', 'Todo', 'List'].join(',')
},
// Meta tags with property attribute.
property: {
'og:image': 'http://ia.media-imdb.com/images/rock.jpg'
},
// Meta tags with httpEquiv attribute.
httpEquiv: {}
}
}
}
```