angular2中有禁用ng的方法吗? [英] is there any alternative for ng-disabled in angular2?

查看:45
本文介绍了angular2中有禁用ng的方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用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的方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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