I would like to show some angular code on web page like
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({name: 'reverseStr'})
export class ReverseStr implements PipeTransform {
transform(value: string): string {
let newStr: string = "";
for (var i = value.length - 1; i >= 0; i--) {
newStr += value.charAt(i);
}
return newStr;
}
}
If I just add it as it is (or wrap with ordinary html tags), it breaks the app. How to fix it? Also can I add language-related coloring to the snippet?