Search Posts

Category: angularjs-filter

md-select-header search doesn’t filter selection

I’m trying to put a search in my md-select-header, but when I type stuff in, the selection list does not filter at all. Am I missing something obvious? I followed the documentation on the angular Material site pretty carefully, but still no luck. <md-select name=”{{field.name}}” ng-model=”fieldValue” ng-model-options=”{getterSetter: true}” ng-disabled=”field.isReadonly()” md-on-close=”clearSearchTerm()” data-md-container-class=”selectdemoSelectHeader”> <md-select-header class=”demo-select-header”> <input ng-model=”searchTerm” ng-keydown=”$event.stopPropagation()” type=”search” placeholder=”Search for..” class=”demo-header-searchbox md-text”> </md-select-header> <md-option ng-value=”c.label” ng-repeat=”c in field.choices track by c.value | filter:searchTerm”>{{c.label}}</md-option> </md-select> Source: AngularJS

filter function in ng options repetitive call issue

I have a dropdown in an ng-repeat which stores id of the item in ng-model <tr ng-repeat=”bill in billItems track by $index”> And, I have a filter in my ng-options that iterates over a list like this:- <td> <select ng-model=”bill.itemId” ng-required=”true” ng-options=”item.itemId as item.itemName for item in itemRates | exclude: bill.itemId: billItems”> <option value=””>Select Here</option> </select> </td> And an add button that adds the same dropdown below, but does not show the option already selected […]

angularjs ng-repeat filter multiple fields in select options

I have problem while filtering based on options in select and then filter in ng-repeat with multiple fields. If i select English Language i have to get English movies and if i select English , Hindi i have to get both English and Hindi Movies together. Here is my code <div class=”container languageSelect pull-right col-xs-12″ ng-app=”myApp” ng-controller=”moviesCtrl”> <select id=”selectTitle” ng-options=”option for option in languageslist” ng-model=”selectedLang.movielanguage” multiple=”multiple”></select> </div> <div class=””> <figure class=”movie” ng-repeat=”record in movieslist | […]

angularjs custom sum filter doesn’t work

im trying to do sum operation on my table Like Item Price abc 10 xyz 20 Ites=>2 Price=>30 For this i wrote simple custome filter .filter(‘SumOfAmt’, function () { return function (data, key) { if (angular.isUndefined(data) || angular.isUndefined(key)) return 0; var sum = 0; angular.forEach(data, function (value) { sum = sum + parseInt(value[key]); Html code <form name=”form1″ ng-submit=”SaveDb(form1.$valid)” novalidate> <b>cost</b><input type=”number” ng-model=”cost” required /> </form> This is my Table when user enter in form it […]

How to filter an nested object array by value in angular expression?

I’m using an ng-repeat where each object (item) is as below: { “properties”: [ {“value”:”started”,”key”:”status”}, {“value”:”somename”,”key”:”name”}, {“value”:”10″,”key”:”age”}, ] } How do I get the value corresponding to key ‘status’ I have tried: <span class=”badge”>{{item.properties[‘value’] | filter:{item:{properties:{key:’status’}}}}}</span> but no luck. Thanks, Rohith Source: AngularJS

AngularJS filter field according to values of an array

I have an Array and this array contains some Id’s. I would like to filter my result according to Id’s. For Example please see the below code snippet. How can I show the records which ‘StatusId’ located in the ‘ids’ array? According to my example, I want to list only: AAA BBB CCC <html> <script src=”https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js”></script> <script src=”https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js”></script> <script> angular.module(‘myApp’, []).controller(‘ctrl’, function ($scope) { $scope.ids = [{ “id”: 1 }, { “id”: 2 }, { […]

Formating dates in AngularJS ng-repeat directive from json array

I’m obtaining a response in json format from laravel application like below: [{“id”:11,”name”:”test”,”description”:”adddas”,”isDone”:false,”created_at”:{“date”:”2017-09-06 12:23:23.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:12,”name”:”test2″,”description”:”asdasdsa”,”isDone”:false,”created_at”:{“date”:”2017-09-13 06:23:22.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:13,”name”:”task12321″,”description”:”jakis tam testowy task”,”isDone”:false,”created_at”:{“date”:”2017-09-03 18:44:57.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:14,”name”:”task12321″,”description”:”jakis tam testowy task”,”isDone”:false,”created_at”:{“date”:”2017-09-03 20:23:58.000000″,”timezone_type”:3,”timezone”:”UTC”}},{“id”:15,”name”:”task12321″,”description”:”jakis tam testowy task”,”isDone”:false,”created_at”:{“date”:”2017-09-03 20:45:35.000000″,”timezone_type”:3,”timezone”:”UTC”}}] I’m trying to format these data in Angular js in ng-repeat directive in way like below: <div class=”table-responsive”> <table class=”table table-hover”> <thead> <tr> <th>name</th> <th>Created at</th> </tr> </thead> <tbody> <tr ng-repeat=”task in tasks”> <td>{{task.name}}</td> <td>{{ task.created_at.date | date:’yyyy-MM-dd HH:mm:ss’ }}</td> </tr> </tbody> </table> </div> The problem is with […]