我正在尝试获取条件值,这是在typescript中导出的类,但无法获取dispay属性值,并且在浏览器上显示我[object HTMLDivElement]
@Component({
template:`<div #noRecordFoundMsg class="ui-widget-header ui-helper-clearfix"
style="padding:4px 10px;border-bottom: 0 none;display:{{ displayAttribute }}"> <-----here
<span>{{ noRecordFoundMsg }}</span>
</div>`})
private displayAttribute: string;
exported class Demo{
//some code
if (Counts === 0) {
this.noRecordFoundMsg = "No Record Found";
this.displayAttribute = "none";
} else {
this.displayAttribute = "block";
}
}
答案 0 :(得分:2)
你试过吗,[style.display]="displayAttribute"
:
@Component({
template:`<div #noRecordFoundMsg class="ui-widget-header ui-helper-clearfix"
[style.display]="displayAttribute"
style="padding:4px 10px;border-bottom: 0 none;"> <-----here
<span>{{ noRecordFoundMsg }}</span>
</div>`})