我希望在HTML模板中显示组件的代码,而不是代码生成的值,而是实际的代码。
但是如果我必须为所有 { 进行转义,这会有问题,请帮忙?
像这样:
import { Injectable } from '@angular/core';
import { Resolve, ActivatedRouteSnapshot } from '@angular/router';
import {CompetitionService} from "../shared/competition.service";
import {Observable} from "rxjs";
@Injectable()
export class TableResolve implements Resolve<any> {
constructor(private competitionService:CompetitionService) {}
resolve(route: ActivatedRouteSnapshot):Observable<> {
return this.competitionService.getTeams(route.params['id']);
}
}
这整段代码就像在stackoverflow的问题部分展示的那样。我尝试使用<pre>
和<code>
,但都没有效果,我在控制台中得到了这个错误。
Error: Template parse errors: Unexpected character "EOF" (Do you have an unescaped "{" in your template? Use "{{ '{' }}") to escape it.)
但是如果我必须为所有 { 进行转义,这会有问题,请帮忙?