我有这样的两个组成部分:有条件的工作不正常?
<app-z-grid [master]="true" title="Tip korisnika" *ngIf="showTab('Tip/podtip korisnika') || showTab('Tip korisnika')" [restPath]="'customertype'" (fillDetailParent)="reinit($event)"></app-z-grid>
<app-z-grid title="Podtip korisnika" *ngIf="showTab('Tip/podtip korisnika') || showTab('Podtip korisnika')" [path]='"customerclassification/customerstype.json"' [restPath]="'customerstype'" [isDetail]="'customerstype'" [parentName]="'customertypeCode'" ></app-z-grid>
首先有一个主站和第二个不。
我想要的是设置condtional为禁用按钮,如果它不是,如果action.name掌握和==“创造”!
[disabled]="(!master) && (action.name !== 'create')"
但问题是,不工作我得到第一个组件的所有按钮启用,并为第二优先启用。任何建议?
<button *ngFor="let action of grid.actions" [disabled]="action.name !== 'create'" name="{{action.name}}"
type="submit" class="btn btn-block-container mousePointer" (click)="this[action.callback]('New', grid.actions)" title="{{action.label}}">
<i *ngIf="action.icon" style="color: white !important" class="{{action.icon}}"></i>
</button>
JSON:
如果要禁用一个按钮,你应该使用它作为disabled="disabled"
哪里,你都将其设置为true或false引导的
"actions":[
{"name":"create","label":"New", "icon":"fa fa-file buttonicon","disabled":false, "callback":"create"},
{"name":"update","label":"Edit", "icon":"fa fa-pencil-square-o buttonicon", "disabled":true, "callback":"edit"},
{"name":"deletemodal","label":"Delete", "icon":"fa fa-trash buttonicon", "disabled":true, "callback":"deletemodal"}
],
是什么'master'的和'action'指TI – Aravind
主只是我知道这是模板中的第一个组件,以及我有一些功能的动作..create,编辑,更新,所以我想只显示创建 – None
我添加了按钮的HTML它看起来像 – None