An open API service indexing awesome lists of open source software.

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.

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)