javascript - ng-repeat track by id working,how to filter in ng-repeat -


this js code list of json array, kept in scope model , used in html binding..

var app = angular.module('starter', []);  app.controller('customersctrl', function($scope) {    $scope.response = [{      "__type": "corstest.salesvisit",      "empid": null,      "svid": "1",      "svtargetcrowd": null,      "svcompanyname": "software solutions",      "svservice": null,      "svdomain": null,      "svownname": "name",      "svcontactno": "9882563143",      "svemailid": null,      "svstatus": "prospective",      "svnvdate": null,      "svcomments": null,      "svvisitname": "brand",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "2",      "svtargetcrowd": null,      "svcompanyname": "software solutions",      "svservice": null,      "svdomain": null,      "svownname": "nameman",      "svcontactno": "9824563143",      "svemailid": null,      "svstatus": "prospective",      "svnvdate": null,      "svcomments": null,      "svvisitname": "service",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "3",      "svtargetcrowd": null,      "svcompanyname": "xyz pvt ltd",      "svservice": null,      "svdomain": null,      "svownname": "xyz",      "svcontactno": "8877465544",      "svemailid": null,      "svstatus": "followups",      "svnvdate": null,      "svcomments": null,      "svvisitname": "brand",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "4",      "svtargetcrowd": null,      "svcompanyname": "abc pvt ltd",      "svservice": null,      "svdomain": null,      "svownname": "abc",      "svcontactno": "9876643210",      "svemailid": null,      "svstatus": "call backs",      "svnvdate": null,      "svcomments": null,      "svvisitname": "brand",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "5",      "svtargetcrowd": null,      "svcompanyname": "companyname",      "svservice": null,      "svdomain": null,      "svownname": "contactperson",      "svcontactno": "9698098720",      "svemailid": null,      "svstatus": "not interested",      "svnvdate": null,      "svcomments": null,      "svvisitname": "rem",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "16",      "svtargetcrowd": null,      "svcompanyname": "iejsbdksns",      "svservice": null,      "svdomain": null,      "svownname": "ksndhdjd",      "svcontactno": "ukebdjdn",      "svemailid": null,      "svstatus": "closed",      "svnvdate": null,      "svcomments": null,      "svvisitname": "iwjdbsnkz",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "15",      "svtargetcrowd": null,      "svcompanyname": "companys",      "svservice": null,      "svdomain": null,      "svownname": "money",      "svcontactno": "9788478886",      "svemailid": null,      "svstatus": "closed",      "svnvdate": null,      "svcomments": null,      "svvisitname": "fho",      "status": null    }]  });   
  /* here, in html have used ng-repeat , output working when put  ng-repeat: chosen in response track chosen.svid....*/  <!doctype html>  <html>    <head>    <meta charset="utf-8">    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">    <title>service</title>        <link href="css/style.css" rel="stylesheet">      <!-- if using sass (run gulp sass first), uncomment below , remove css includes above      <link href="css/ionic.app.css" rel="stylesheet">      -->      <!-- ionic/angularjs js -->    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>    <!-- cordova script (this 404 during development) -->    <script src="cordova.js"></script>      <!-- app's js -->    <script src="js/app.js"></script>  </head>    <body ng-app="starter">    <div ng-controller="customersctrl" ng-cloak>      <h1>values</h1>      <ul class="chosen" dnd-list="model">        <li ng-repeat="chosen in response track chosen.svid">          {{chosen.svcompanyname}}<br>          {{chosen.svownname}}<br>          {{chosen.svcontactno}}<br>          {{chosen.svstatus}}<br>          <h2>---------------------</h2>        </li>      </ul>      <!-- <div>       <span>{{response}}</span>     </div>     <span>{{error}}</span>-->    </div>  </body>    </html>
question is: need track chosen.svid , need filter json using item inside array named svstatus.(i.e) need output

 iejsbdksns  ksndhdjd  ukebdjdn  closed  ---------------------   companys  money  9788478886  closed  --------------------- 

i need output this, need items svstatus closed. please suggest me coding achieve output please.. in advance..

ng-if ng-repeat it!

var app = angular.module('starter', []);  app.controller('customersctrl', function($scope) {    $scope.response = [{      "__type": "corstest.salesvisit",      "empid": null,      "svid": "1",      "svtargetcrowd": null,      "svcompanyname": "software solutions",      "svservice": null,      "svdomain": null,      "svownname": "name",      "svcontactno": "9882563143",      "svemailid": null,      "svstatus": "prospective",      "svnvdate": null,      "svcomments": null,      "svvisitname": "brand",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "2",      "svtargetcrowd": null,      "svcompanyname": "software solutions",      "svservice": null,      "svdomain": null,      "svownname": "nameman",      "svcontactno": "9824563143",      "svemailid": null,      "svstatus": "prospective",      "svnvdate": null,      "svcomments": null,      "svvisitname": "service",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "3",      "svtargetcrowd": null,      "svcompanyname": "xyz pvt ltd",      "svservice": null,      "svdomain": null,      "svownname": "xyz",      "svcontactno": "8877465544",      "svemailid": null,      "svstatus": "followups",      "svnvdate": null,      "svcomments": null,      "svvisitname": "brand",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "4",      "svtargetcrowd": null,      "svcompanyname": "abc pvt ltd",      "svservice": null,      "svdomain": null,      "svownname": "abc",      "svcontactno": "9876643210",      "svemailid": null,      "svstatus": "call backs",      "svnvdate": null,      "svcomments": null,      "svvisitname": "brand",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "5",      "svtargetcrowd": null,      "svcompanyname": "companyname",      "svservice": null,      "svdomain": null,      "svownname": "contactperson",      "svcontactno": "9698098720",      "svemailid": null,      "svstatus": "not interested",      "svnvdate": null,      "svcomments": null,      "svvisitname": "rem",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "16",      "svtargetcrowd": null,      "svcompanyname": "iejsbdksns",      "svservice": null,      "svdomain": null,      "svownname": "ksndhdjd",      "svcontactno": "ukebdjdn",      "svemailid": null,      "svstatus": "closed",      "svnvdate": null,      "svcomments": null,      "svvisitname": "iwjdbsnkz",      "status": null    }, {      "__type": "corstest.salesvisit",      "empid": null,      "svid": "15",      "svtargetcrowd": null,      "svcompanyname": "companys",      "svservice": null,      "svdomain": null,      "svownname": "money",      "svcontactno": "9788478886",      "svemailid": null,      "svstatus": "closed",      "svnvdate": null,      "svcomments": null,      "svvisitname": "fho",      "status": null    }]  });
/* here, in html have used ng-repeat , output working when put  ng-repeat: chosen in response track chosen.svid....*/  <!doctype html>  <html>    <head>    <meta charset="utf-8">    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">    <title>service</title>        <link href="css/style.css" rel="stylesheet">      <!-- if using sass (run gulp sass first), uncomment below , remove css includes above      <link href="css/ionic.app.css" rel="stylesheet">      -->      <!-- ionic/angularjs js -->    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>    <!-- cordova script (this 404 during development) -->    <script src="cordova.js"></script>      <!-- app's js -->    <script src="js/app.js"></script>  </head>    <body ng-app="starter">    <div ng-controller="customersctrl" ng-cloak>      <h1>values</h1>      <ul class="chosen" dnd-list="model">        <li ng-repeat="chosen in response track chosen.svid" ng-if="chosen.svstatus=='closed'">          {{chosen.svcompanyname}}<br>          {{chosen.svownname}}<br>          {{chosen.svcontactno}}<br>          {{chosen.svstatus}}<br>          <h2>---------------------</h2>        </li>      </ul>      <!-- <div>       <span>{{response}}</span>     </div>     <span>{{error}}</span>-->    </div>  </body>    </html>


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -