我有這樣的兩個組成部分:有條件的工作不正常?
<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