npm i @angular-package/prism
app.module.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { HttpClientModule } from '@angular/common/http'; import { AppComponent } from './app.component'; import { ApPrismModule } from '@angular-package/prism'; import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; @NgModule({ imports: [ ApPrismModule, BrowserModule, FormsModule, ReactiveFormsModule, HttpClientModule, NgbModule ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { } |
app.component.ts
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import { Component } from '@angular/core'; @Component({ selector: 'my-app', templateUrl: './app.component.html', styleUrls: [ './app.component.css' ] }) export class AppComponent { title = 'Highlight Code With Prims In Angular App '; content = ` <ngb-tabset> <ngb-tab title="Simple2"> <ng-template ngbTabContent> <ngx-prism language="html"> <ng-content select=".app-code-html"></ng-content> </ngx-prism> </ng-template> </ngb-tab> </ngb-tabset> ` } |
app.component.html
1 2 |
<h2>{{title}}</h2> <ngx-prism language="html"> {{ content }}</ngx-prism> |
FULL SOURCE CODE