禁用HTML输入"最小值"验证

时间:2016-01-29 15:24:01

标签: javascript html angularjs

我对Angular.js双向数据绑定有问题。 我从服务器接到一个AJAX调用,我得到了我可以在网站上显示的所有数据,但日期输入有问题。我为它设置了一个最小值,但是一些日期(我从数据中得到的)小于最小值。 因此,HTML验证会将我的数据转换为undefined。

的index.html

EnableClientScript="false"

myController.js

<div class="col-sm-12" ng-repeat="item in products">
    <input type='date'
           ng-model='item.theDate'
           min='{{myMinDate}}'>
</div>

所以换句话说,如果我不使用min属性作为输入,一切正常,但如果使用它,那么function init() { productFactory.getSession().success(handleSuccess); //the getSession function is in the productFactory file }; var handleSuccess = function (data, status) { $scope.products = data.Products; $scope.myMinDate = data.minimumDate; }; init(); 将是$scope.products.theDate

(抱歉我的语法)。

0 个答案:

没有答案
相关问题