Angular 在不在角度模式下工作的组件上添加自定义禁用输入
我有一个角度的组件,其中包含一个按钮 我已将组件设置为禁用输入名称,如下所示:Angular 在不在角度模式下工作的组件上添加自定义禁用输入,angular,Angular,我有一个角度的组件,其中包含一个按钮 我已将组件设置为禁用输入名称,如下所示: export class ConfirmationButtonComponent implements OnInit { @Input() icon: string; @Input() tooltip: string; @Input() disabled: boolean; <app-confirmation-button [icon]="'select-all'" disa
export class ConfirmationButtonComponent implements OnInit {
@Input() icon: string;
@Input() tooltip: string;
@Input() disabled: boolean;
<app-confirmation-button
[icon]="'select-all'"
disabled="missions.length === 0"
tooltip="{{ 'BUTTON.DELETE_ALL' | translate}}"
我这样称呼它:
export class ConfirmationButtonComponent implements OnInit {
@Input() icon: string;
@Input() tooltip: string;
@Input() disabled: boolean;
<app-confirmation-button
[icon]="'select-all'"
disabled="missions.length === 0"
tooltip="{{ 'BUTTON.DELETE_ALL' | translate}}"
然后我试着用另一种方法
<app-confirmation-button
[icon]="'select-all'"
disabled="{{missions.length === 0}}"
tooltip="{{ 'BUTTON.DELETE_ALL' | translate}}"
所以是字符串而不是布尔值
如何得到布尔值 确定我使用
[disabled]
修复了此问题。我将阅读有关使用[
和不使用绑定的内容