https://github.com/coryrylan/ngx-json-ld
:pencil: A small component to easily bind JSON-LD schema to Angular templates.
https://github.com/coryrylan/ngx-json-ld
angular angular2 json-ld schema-org
Last synced: 6 months ago
JSON representation
:pencil: A small component to easily bind JSON-LD schema to Angular templates.
- Host: GitHub
- URL: https://github.com/coryrylan/ngx-json-ld
- Owner: coryrylan
- Archived: true
- Created: 2017-10-23T19:48:47.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-10T04:02:53.000Z (about 8 years ago)
- Last Synced: 2025-08-22T06:18:42.116Z (8 months ago)
- Topics: angular, angular2, json-ld, schema-org
- Language: TypeScript
- Homepage:
- Size: 179 KB
- Stars: 28
- Watchers: 4
- Forks: 5
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## This project has moved and can now be found [here](https://github.com/coryrylan/ngx-libraries).
## ngx-json-ld
A small component to easily bind [JSON-LD](https://developers.google.com/search/docs/guides/intro-structured-data) schema to Angular templates.
## [Demo](https://stackblitz.com/edit/angular-oyrw84)
## Installation
To install this library, run:
```bash
$ npm install ngx-json-ld --save
```
and then from your Angular `AppModule`:
```typescript
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import library module
import { NgxJsonLdModule } from 'ngx-json-ld';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
// Register module
NgxJsonLdModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```
## Component
Once the library is imported, you can use the `ngx-json-ld` component.
```typescript
@Component({
selector: 'app',
template: ``
})
class AppComponent {
schema = {
'@context': 'http://schema.org',
'@type': 'WebSite',
'name': 'angular.io',
'url': 'https://angular.io'
};
}
```
## Output
```xml
{
"@context": "http://schema.org",
"@type": "WebSite",
"name": "angular.io",
"url": "https://angular.io"
}
```
## License
MIT © [Cory Rylan](https://coryrylan.com)