简体   繁体   English

ng-disabled 不使用

[英]ng-disabled not working with <i> tag using font-awesome

I have created a plunk in which I want to validate a form that has a button created using font-awesome. 我创建了一个plunk,我想在其中验证一个使用font-awesome创建的按钮的表单。 The text field is required and I want to disabled the icon if no data is entered.But ng-disabled dosen't seem to support this functionality with font awesome icon. 文本字段是必需的,如果没有输入数据,我想要禁用该图标。但ng-disabled此功能似乎不支持使用字体真棒图标的此功能。 Has anyone faced this issue before.Please share your thoughts.. 有没有人遇到过这个问题。请分享你的想法..

Please find the plunk here 请在这里找到插件

Place it inside a button and it should work: 将它放在一个按钮内,它应该工作:

    <button ng-disabled="testForm.$invalid" ng-click="$ctrl.checkIfClicked()">
      <i class="fa fa-floppy-o fa-2x"></i>
    </button>

You can format the style of the button in a way you want. 您可以按照自己想要的方式格式化按钮的样式。

In file css you can add 在文件css中,您可以添加

.disabled { cursor: not-allowed; .disabled {cursor:not-allowed; } }

And in html file, you change 在html文件中,你改变了

<i class="fa fa-floppy-o fa-2x" ng-class="{disabled: testForm.$invalid}" aria-hidden="true" ng-click="$ctrl.checkIfClicked()"></i>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM