import {AfterViewInit, Component, ElementRef} from '@angular/core'; import {IOption} from 'ng-select'; declare var hljs: any; import {OptionService} from '../../services/option.service'; @Component({ selector: 'highlight-color', templateUrl: './highlight-color.component.html' }) export class HighlightColor implements AfterViewInit { characters: Array = this.optionService.getCharacters(); selectedCharacter: string = '3'; selectedCharacters: Array = ['1', '3']; constructor( private elementRef: ElementRef, private optionService: OptionService ) {} ngAfterViewInit() { hljs.initHighlighting(); let nodes: NodeList = this.elementRef .nativeElement .querySelectorAll('.typescript, .html, .css'); for (let i = 0; i < nodes.length; i++) { hljs.highlightBlock(nodes[i]); } } html0: string = `
<ng-select
    highlightColor="#9575cd"
    highlightTextColor="#fff"
    [options]="characters">
</ng-select>
`; ts0: string = `
import {Component} from '@angular/core;'
import {IOption} from 'ng-select';
import {OptionService} from '../../services/option.service';

@Component({
    selector: 'highlight-color',
    templateUrl: './highlight-color.component.html'
})
export class HighlightColorExample {

    characters: Array<IOption> = this.optionService.getCharacters();

    constructor(
        private optionService: OptionService
    ) {}
}
`; html1: string = `
<ng-select
    highlightColor="#9575cd"
    highlightTextColor="#fff"
    [options]="characters"
    [multiple]="true">
</ng-select>
`; ts1: string = `
import {Component} from '@angular/core;'
import {IOption} from 'ng-select';
import {OptionService} from '../../services/option.service';

@Component({
    selector: 'highlight-color',
    templateUrl: './highlight-color.component.html'
})
export class HighlightColorExample {

    characters: Array<IOption> = this.optionService.getCharacters();

    constructor(
        private optionService: OptionService
    ) {}
}
`; }