angular2 中的 ng-disabled 是否有其他选择? [英] is there any alternative for ng-disabled in angular2?

查看:27
本文介绍了angular2 中的 ng-disabled 是否有其他选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 angular2 进行开发,并且想知道 angular2 中的 ng-disabled 是否有任何替代方案.

I am using angular2 for development and was wondering if there is any alternative for ng-disabled in angular2.

例如.下面的代码在 angularJS 中:

For ex. below code is in angularJS:

<button ng-disabled="!nextLibAvailable" ng-click="showNext('library')" class=" btn btn-info btn-xs" title="Next Lib >> {{libraries.name}}">
    <i class="fa fa-chevron-right fa-fw"></i>
</button>

只是想知道我怎样才能实现这个功能?任何输入?

Just wanted to know How can I achieve this functionality? any inputs?

推荐答案

要将 disabled 属性设置为 truefalse 使用

To set the disabled property to true or false use

<button [disabled]="!nextLibAvailable" (click)="showNext('library')" class=" btn btn-info btn-xs" title="Next Lib"> {{libraries.name}}">
    <i class="fa fa-chevron-right fa-fw"></i>
</button>

这篇关于angular2 中的 ng-disabled 是否有其他选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆