ng-disabled使用font-awesome不能使用标记

时间:2022-08-22 17:04:34

I have created a plunk in which I want to validate a form that has a button created using 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. Has anyone faced this issue before.Please share your thoughts..

我创建了一个plunk,我想在其中验证一个使用font-awesome创建的按钮的表单。文本字段是必需的,如果没有输入数据,我想要禁用图标。但禁用 - 禁用似乎不支持使用字体真棒图标的此功能。有没有人遇到过这个问题。请分享你的想法..

Please find the plunk here

请在这里找到插件

2 个解决方案

#1


8  

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.

您可以按照所需的方式格式化按钮的样式。

#2


0  

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>

#1


8  

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.

您可以按照所需的方式格式化按钮的样式。

#2


0  

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>