import {Component, ElementRef} from '@angular/core'; declare var hljs: any; @Component({ selector: 'getting-started', templateUrl: './getting-started.component.html' }) export class GettingStarted { installNpm: string = `
$ npm install --save ng-select`;
installYarn: string = `$ yarn add ng-select`;
moduleTypescript: string = `import {NgModule} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {SelectModule} from 'ng-select';
import {AppComponent} from './app.component';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule
SelectModule
],
bootstrap: [
AppComponent
]
})
export class AppModule {}`;
componentTemplate: string = `<ng-select
[options]="myOptions">
</ng-select>`;
componentClass: string = `import {Component} from '@angular/core';
import {IOption} from 'ng-select';
@Component({
selector: 'my-example',
templateUrl: 'my-example.component.html'
})
export class MyExampleComponent {
myOptions: Array<IOption> = [
{label: 'Belgium', value: 'BE'},
{label: 'Luxembourg', value: 'LU'},
{label: 'Netherlands', value: 'NL'}
];
}`;
constructor(
private elementRef: ElementRef,
) {}
ngAfterViewInit() {
hljs.initHighlighting();
let nodes: NodeList = this.elementRef
.nativeElement
.querySelectorAll('.typescript, .html, .css, .shell-session');
for (let i = 0; i < nodes.length; i++) {
hljs.highlightBlock(nodes[i]);
}
}
}