Angularjs,ng点击字体awesome span不能用,但在按钮上可以用。

问题描述 投票:0回答:1

我有这段代码。

<input is-password="checkPassword" autocomplete="off" required
       ng-model="vm.simulate.rutDeudor" type="password" minlength="3"
       id="rut-deudor-field" tabindex="2"
       ng-attr-type="{{ isPassword ? 'password' : 'text' }}">
<button ng-click="checkPassword=!checkPassword">Mostrar</button>
<span ng-click="checkPassword=!checkPassword" class="fa fa-lg fa-eye"> 
</span>

我的想法是用 span 而不是 button我不知道为什么用按钮能用,但用span就不行了。

这是控制器。

angular.module('app.factoringCotizarDocs')
.controller('sincronizarCarpetaTributariaModalCtrl', sincronizarCarpetaTributariaModalCtrl)
.directive('isPassword', function() {
  return {
    restrict : 'A',
    scope: {
      isPassword: '=isPassword'
    },
    link: function (scope, element, attrs) {
      scope.$watch('isPassword', function(a, b){
        element.attr('type', a ? 'text' : 'password')
      })
    }
  }
});
angularjs
1个回答
0
投票

ng-click 运作良好 span. 所以我认为问题出在你的项目中的一些冲突。

这里有一个 示范灌浆机

© www.soinside.com 2019 - 2024. All rights reserved.