javascript - Filter ng-repeat by input date -


i'm working on 1 of first angularjs projects , i'm stuck. trying do?

i'm trying filter ng-repeat selected date input type = date view:

<div class="form-group col-md-3">     <label for="date">tender date</label>     <input type="date" id="date" ng- model="searchdate.tenderdate"class="form-control"> </div>  <div >     <table class="table table-bordered">          <thead>              <th>tender id</th>             <th>business unit</th>             <th>therapy unit</th>             <th>tender date</th>          </thead>         <tbody ng-repeat="tender in tenders | filter:searchdate">             <td>{{tender.tenderid}}</td>             <td>{{tender.businessunit}}</td>             <td>{{tender.therapyunit}}</td>              <td>{{tender.tenderdate}}</td>         </tbody>      </table>   </div> 

this json file:

{ "tenders":[{             "businessunit": "gn_re s-retail",             "therapyunit" : "hospital product ",             "tenderid" : "be_13_n2.1_001",             "tenderdate" : "2016-03-17"             },              {                 "businessunit": "gn_re s-retail",                 "therapyunit" : "hospital product ",                 "tenderid" : "be_13_n2.1_01",                 "tenderdate" : "2016-03-18"             }               ] } 

i have nothing in controller. able link searchfield a particular field in array problem date type isn't working. hope guys can me!

try this.

var myapp = angular.module('app', []);  myapp.controller('main', function ($scope) {    $scope.tenders = {  "tenders":[{              "businessunit": "gn_re s-retail",              "therapyunit" : "hospital product ",              "tenderid" : "be_13_n2.1_001",              "tenderdate" : "2016-03-17"              },                {                  "businessunit": "gn_re s-retail",                  "therapyunit" : "hospital product ",                  "tenderid" : "be_13_n2.1_01",                  "tenderdate" : "2016-03-18"              }                  ]  };  });
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>  <div ng-app = "app">    <div ng-controller="main">      <div class="form-group col-md-3">      <label for="date">tender date</label>      <input type="date" id="date" ng-model="searchdate"class="form-control">  </div>    <div >      <table class="table table-bordered">            <thead>                <th>tender id</th>              <th>business unit</th>              <th>therapy unit</th>              <th>tender date</th>            </thead>          <tbody ng-repeat="tender in tenders.tenders | filter: {tenderdate: searchdate }">              <td>{{tender.tenderid}}</td>              <td>{{tender.businessunit}}</td>              <td>{{tender.therapyunit}}</td>                <td>{{tender.tenderdate}}</td>          </tbody>        </table>      </div>     </div>  </div>


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -