File

modules/seo-text-component/src/seo-text.component.ts

Description

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>

Metadata

selector seo-text
styleUrls seo-text.component.scss
templateUrl seo-text.component.html

Inputs

indexBlock

Index of text in blocks array

Type: number

Default value: 0

url

Page url

Type: string

Constructor

constructor(dal: any)

Properties

Private seoText
seoText: string

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;
        });
    }

}

results matching ""

    No results matching ""