小编Man*_*hmi的帖子

如何在Angular4的PRIMENG中的对话框组件的标题中创建按钮

我想在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)

primeng angular

2
推荐指数
1
解决办法
3659
查看次数

如何在 angular2 中为复杂的多个条件编写内联 [ngStyle]

在这里,我想在 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)

ng-class ng-style angular

-4
推荐指数
1
解决办法
6976
查看次数

标签 统计

angular ×2

ng-class ×1

ng-style ×1

primeng ×1