【发布时间】:2017-11-19 14:35:04
【问题描述】:
我从 json 文件中获取 html 实体,例如:’
如何在 html 组件中取消转义?
我创建了自定义管道,但它仅适用于 & 之类的实体:
import { Pipe, PipeTransform } from '@angular/core';
import {unescape} from 'lodash';
@Pipe({
name: 'unescape'
})
export class UnescapePipe implements PipeTransform {
transform(value: any, args?: any): any {
return unescape(value);
}
}
- 我正在使用 Angular 5。
【问题讨论】: