【发布时间】:2017-06-18 04:20:44
【问题描述】:
我不知道做错了什么,因为没有报告错误。
我有一个组件类
import { Component, OnInit, ViewContainerRef } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
testhtml = "<p>Hello world</p>";
constructor(){}
}
}
在我的模板文件中,我做了这样的事情:
<div class="blog-post">[innerHtml]="testhtml"</div>
但这似乎不起作用。还有什么我需要导入的吗?
我正在使用 angular-cli "version": "1.0.0-beta.26",
【问题讨论】:
-
<div class="blog-post" [innerHtml]="testhtml"></div>
标签: angular