angularjs:动态设置最小时间<input type =“time”/>不工作

时间:2016-06-13 11:25:27

标签: javascript angularjs

我正在尝试将最小时间动态设置为当前时间,但它不起作用。它没有显示错误。我哪里出错?

$scope.mintime = new Date();
<label class="item item-input item-stacked-label">
  <span class="input-label" >Preferred Time</span>
  <input type="time" class="input-control" name="requestTime"  ng-model="request.time" ng-change="checktime();" min="{{mintime | date:'hh:mm a'}}" required>
</label>

2 个答案:

答案 0 :(得分:2)

试试这个:min="{{mintime | date:'HH:mm:ss'}}"

它只是关于格式:)

答案 1 :(得分:0)

<div class="row col-sm-offset-1"  *ngFor="let item of itemsArray let idx=index">
    <div class="col-sm-4">
        <div class="row assignedItem">
            <span class="glyphicon glyphicon-plus-sign " title="sub items"  (click)= "showSubItems[idx] = !showSubItems[idx]"></span>

            <div class=" itemName" title="State:{{item.state}},Type: {{item.type}}">{{item.name}}</div>
            <!--users component-->

        <!--show subItems-->
        <itemComp [itemsArray]='item.children' class="col-sm-offset-1 subItemHiden" [class.subItemsShow] = 'showSubItems[idx]'></itemComp>
    </div>
</div>

查看小提琴http://jsfiddle.net/ebinmanuval/jzczzz40/

否则你必须检查<form name="myForm"> <label class="item item-input item-stacked-label"> <span class="input-label">Preferred Time</span> <input type="time" class="input-control" name="requestTime" ng-model="request.time" ng-change="checktime();" min="{{date | date:'HH:mm:ss'}}" required> </label> {{myForm.requestTime.$valid}} <button type="submit">Submit</button> </form> angular.module('sampleApp', []) .controller('myCtrl', function($scope) { $scope.date = new Date(); })

中的值