modules/seo-text-component/src/seo-text.component.ts
SEO text component
display SEO text block from specific url. User have to input current url
and optional index of text in blocks
array.
For example:
<seo-text [url]="router.url" [indexBlock]="1"></seo-text>
selector | seo-text |
styleUrls | seo-text.component.scss |
templateUrl | seo-text.component.html |
indexBlock
|
Index of text in
Type:
Default value: |
url
|
Page url
Type: |
constructor(dal: any)
|
Private seoText |
seoText: |
SEO text |
import { Input } from '@angular/core';
import { DbAbstractionLayer } from '@nodeart/dal';
import { Component, OnChanges } from '@angular/core';
/**
* `SEO text component` display SEO text block from specific url. User have to input current `url` and optional index of text in `blocks` array.
*
* For example:
* ```html
* <seo-text [url]="router.url" [indexBlock]="1"></seo-text>
* ```
*/
@Component({
selector: 'seo-text',
templateUrl: './seo-text.component.html',
styleUrls: ['./seo-text.component.scss']
})
export class SeoTextComponent implements OnChanges{
/**
* Page url
*/
@Input() url: string;
/**
* Index of text in `blocks` array
*/
@Input() indexBlock: number = 0;
/**
* SEO text
*/
private seoText: string;
constructor(protected dal: DbAbstractionLayer) {
}
ngOnChanges() {
console.log(this.url, ' <> ', this.indexBlock);
this.dal.getSeoText(this.url, this.indexBlock).subscribe(data => {
this.seoText = data;
});
}
}