我想在primeng对话框窗口的标题中放置一个按钮。该代码的链接为https://www.primefaces.org/primeng/#/dialog。
要求是要在顶部标题的右侧添加两个按钮(带有图像或任何图标作为计算器和问号),这些按钮应调用方法abc()。
model.component.html
---------------------
<p-dialog header="top header title pass here" [(visible)]="display" modal="modal"
draggable="true" dismissableMask="true" positionTop="50" padding="0px" width="1200"
height="350" [responsive]="true">
// here two buttons btn1 and btn2(with icons) next to 'fa fa-fw fa-close' icon.
<p>The stor.</p>
<p-footer>
<button type="button" pButton icon="fa-check" (click)="display=false"
label="Yes">hghk</button>
</p-footer>
</p-dialog>
<button type="button" (click)="showDialog()" pButton icon="fa-external-link-square"
label="Show">Lead</button>
model.component.ts
---------------------
display = false;
showDialog() {
this.display = true;
}
Run Code Online (Sandbox Code Playgroud) 在这里,我想在 div 中传递一个条件,当它包含某个数字时显示某种颜色。
条件是:
if (num >= -100.0 && num <= -35.0) {
return '#f1403b';
} else if (num > -35.0 && num <= 35.0) {
return '#ffc200';
} else {
return '#34A853';
}
app.component.html
---------------------
<div [ngStyle]="{'color': (num >= '-100.0' && num <= '-35.0' ) ? '#f1403b' : ( (num > '-35.0' && num <= '35.0') ? '#ffc200' :'#34A853')
}">
({{num}})
</div>
Run Code Online (Sandbox Code Playgroud)