jQuery touchstart无法用于模式字段

时间:2018-07-10 17:51:04

标签: javascript jquery angularjs

在我的angularJs项目中,touchstart事件不适用于模态字段(下面的代码中的 rate1 ),但是页面中的非模态字段运行良好。任何帮助将不胜感激。

请在下面找到我的代码:

<div class="percentage-field">
    <span ng-show="!capEntering1 && addQuteFormPopup.interestRate1.$touched" class="double-digit" ng-if="!fhaCtrl.isDisabled">%</span>
    <input type="text" id="rate1" name="interestRate1" placeholder="XX.XXX %"  ng-class="{'error': addQuteFormPopup.interestRate1.$touched && fhaCtrl.interestRate1 ==='0.0'}" ng-disabled="fhaCtrl.isDisabled" gw-allow-only="numbers dots" number-format="5,3" maxlength="6" ng-model="fhaCtrl.interestRate1"
    class="form-control" ng-blur="capEntering1 = false;" ng-focus="capEntering1 = true"><span class="double-digit" ng-if="fhaCtrl.isDisabled" ng-init="capEntering1 = true">%</span>
</div>

控制器代码:

 angular.element(document).ready((): void => {
    $('#editLoanAmount').on('touchstart', (): void => {
        $('#editLoanAmount').attr('type', 'number');
    });
        $('#editDti').on('touchstart', (): void => {
        $('#editDti').attr('type', 'number');
    });
    $('#rate1').on('touchstart', (): void => {
        $('#rate1').attr('type', 'number');
    });
});

0 个答案:

没有答案