FAQ Database Discussion Community


ng-options filter based on selected value

angularjs,angular-filters,angularjs-ng-options
I've to write a directive to edit labels for an app. Each culture (eg: en-US) can have maximum 4 labels per property which are contained into a table : $scope.suffixes = ["DisplayName", "Description", "Hint", "Help"]; <div class="clear" ng-repeat="label in labelModel | filter:cultureFilter"> <select ng-options="suffix as suffix for suffix in suffixes...

How to get value from ng-repeat when event not from element within ng-repeat (i.e. not ng-click)

javascript,angularjs,angularjs-directive,angularjs-ng-repeat,angular-filters
I have a lookahead fuzzy search directive for category tagging: <input type="text" class="form-control" placeholder="Apply Tags" ng-keydown="checkKeyDown($event)" ng-change="searchTags()" ng-model="searchText"> <div ng-show="searchText.length>0"> <ul> <li ng-repeat="tag in suggestedTags | fuzzySearch : searchText : 'OR' track by $index" ng-class="{active : $index === selectedIndex}"> {{tag}} </li> </ul> </div> This is how I'm handling things suggestedTags:...

Accessing results of Angular filter outside of nested repeat

angularjs,angularjs-ng-repeat,angular-filters
I've been searching and fiddling with this for about a day now with no luck. I have a site using AngularJS 1.3.6 where I need to get the results of a filter outside of several nested ng-repeats. I'm filtering the rows in several tables, and the filter itself is working...

My angular filter is running 3 times then returns nothing

angularjs,angular-filters
My filter runs 3 times, the first execution gives the results the I want, but it runs again 2 times returning nothing. My question is why it is calling the filter again 2 times? This is my code to my filter .filter("range", function ($filter) { return function (data, page, size)...

format phone number using angularJs

javascript,angularjs,number-formatting,phone-number,angular-filters
How would I format a number like: (99) 9999-9999 into: 9999999999 using angularjs? someone told me to use phoneformat.js but I don't know how to implement it in my project

Removing brackets around a string and placing contents into new object

javascript,regex,angularjs,angular-services,angular-filters
I have an angular service which returns an array with a number of objects inside. $scope.data: [ { date: "03/12/2014", name: "mr blue", title: "math teacher (Germany)" }, { date: "04/02/2015", name: "mrs yellow", title: "chemistry teacher (Spain)" }, ] You can see from the title field it contains a...

Making an Angular filter using $http?

javascript,angularjs,scope,angular-filters
I'd like to do an $http get request and return the result to the front-end. On the front-end, I use {{ URL-STRING | iframely }}. 'use strict' angular.module( 'iframely', [] ).filter( 'iframely', [ '$http', function ( $http ) { return function ( url ) { var result = $http( {...

Cannot get filter to execute in AngularJS

javascript,angularjs,date,haml,angular-filters
I have an ng-repeat of events, each of which has a date. I want to allow the user to filter out all events not between two dates. I figured I'd make a custom filter for this. I'm using HAML, so here's how my HTML looks: %tr{'ng-repeat' => 'event in events...

How to filter the data in angularjs?

angularjs,angularjs-scope,angularjs-ng-repeat,angular-filters
I am trying to filter the data according to firstname and title properties but it's not filtering. <label>by Name <input type="text" ng-model="searchText.data.firstname"></label> | <label>by Title <select name="title"> <option value="">All</option> <option value="">Zone Manager</option> <option value="">Logistic agent</option> </select></label> <hr/> <div ng-repeat="accDetails in acct_list | filter:searchText"> {{accDetails.data.firstname}} |...

Can we compare JSON data(MM/DD/YYYY format) in controller with today's date in custom filter and display filtered list in array

javascript,json,angularjs,date,angular-filters
I am trying to compare today's date we get from new Date() with date in MM/DD/YYYY format and filter the list of data in array with my custom filter. Is there a way to compare this..I have tried to set the hours to (0,0,0,0) and compare but it does not...

Can I configure the default angular filter to display strings so that those that start with the search term come first?

javascript,angularjs,sorting,angular-filters
In my project we are displaying a HUGE list of strings (17,000+ sometimes) With an input box for pairing down the list using a filter. I've been using angular's default filter until it was requested that i sort so that strings starting with the search query come before words that...

angular filter in order by letter

javascript,angularjs,angular-filters
I am pretty new to angular. I am trying to add a filter parameter to my controller that will filter a search by every letter in a word, in order of letter. So imagine my data contained the following words: horses, oranges, terminator, Motorola, floral, orthopedic. When I searched for...

Grouping Of Data in AngularJs

angularjs,html5,angular-filters
I am building a site for a restaurant . On the site I am rendering the restaurant menu on a page . The Menu Items Json, I am getting from server looks like this : - { "_id" : ObjectId("54c3c6e6cd7fe7df22cae87e"), "restaurant" : ObjectId("54b3a7ef613e89f64654f2b3"), "name" : "Pasta", "itemCode" : "PST", "price"...

Creating custom angular filters

javascript,angularjs,filter,angular-filters
i have a json of items and a barcode scanner, the barcode scanner inputs directly into my app. Now the items have a primary part number and a secondary part number, more often than not the result from the barcode scanner will be the primary part number, but i have...

How can i Apply filter by taking the arrays First value as Input On check?

angularjs,angular-filters
Iam Learning AngularJs ... Example : - My Json Having an array with some values as types :- Lets Say A Restaurant would be Mexican or Italian Etc My example { name:'res 123', description:'Italian Rest' types:['Mexican','Indian'] } <input type="checkbox" data-ng-model="Mexican"/> // Iam Using Textbox Oncheck Filter Need to Filter all...

AngularJS Custom Filter orderBy sortPredicate not working

javascript,angularjs,sorting,angular-filters,angularjs-orderby
The problem is that I have an array of recipe objects. Each recipe object has some comments on it. I want to sort the array in angularJS controller using the $filter service provided by angular. $scope.recipes = $filter('orderBy')($scope.data, function(recipe) { return recipe.comments.length; }); But its not giving the required results....

AngularJS date filter with condition

angularjs,angular-filters
I use ng-bind and the date filter to output a time of a date. <span ng-bind="ctrl.model.myDate | date:'HH:mm'"><span> Now I would like to be able to switch the output between 12 and 24h format, with this filter: date:'HH:mm' and date:'hh:mm' Therefore I have a property: model.is24h= true How can I...

Multi-Input Custom AngularJS Filter

javascript,html,angularjs,filter,angular-filters
I'm trying to build a custom Angular filter. In my example code, it's filtering a list of names. The filtering is done by a select dropdown with these options: Contains Equals Starts with Ends with Does not contain and then there is also a text field. The text field will...

AngularJS filtering by code

javascript,angularjs,angular-filters
I'm working with AngularJS. How can I search by Code? My current implementation searches what ever you type: id , name, city, code... How can I search only by code? app.js: var app = angular.module('stack', []); app.directive('filterList', function ($timeout) { return { link: function (scope, element, attrs) { var td...

Display size of ng-repeat with filter

angularjs,angularjs-ng-repeat,angular-filters
I am currently working on an analytics backend web app and am using ng-repeat to show a table for some data I am working with. Is there a way to show the number of total results found when using a filter with ng-repeat? I would like to display this beneath...

  in script is not getting compiled

javascript,angularjs,html-select,angular-filters
I have created an application in AngularJS with a drop down with space in option using a filter. The application is working fine but the &nbsp; which I have put for space is not getting compiled. My code is as given below JSFiddle html <select> <option ng-repeat="(key, value) in headers">{{value...

Filter not working after refreshing the page

javascript,angularjs,angular-filters
I have this input search <input type="search" ng-model="query"> <div ng-repeat="sport in sports | filter:query"></div> which is working awesome after the user logs in, but within the same session if the user refreshes the page, the filter doesn't work anymore, if you type something in the search box, nothing happens, the...

custom filter expression for a specific part of a string in angular.js

javascript,angularjs,angular-filters
I want to make a custom filter that only displays the 12th character - 16th character of the string I made this filters.js file : angular.module('customFilters', []).filter('specificDate', function() { return function(input) { }; }); The things i want to put the expression on are all the options from this select...

Filter results in angularjs based on select value

angularjs,angularjs-ng-repeat,ng-options,angular-filters
This seems like it should be easy but I am new to angular and not grasping this concept very well. I am hoping to run an ng-repeat over a dataset and then be able to filter the results based on a selected option in a select box, using the exact...

display array conditionally : Angular

angularjs,angular-filters
I'm trying to filter my array : here is my fiddle : Demo. there are two select list , here is the condition : when top select list === 123 ====> bottom select list should show 001,002,003 and when top select list === 1234 ====> bottom select list should show...

How to Use DropDown Selected Vaue as Parameter for Filter in AngularJs?

javascript,jquery,angularjs,angular-filters
Iam Using Select2 Drop down which is not Filter on Select :- My Code :- <div class="form-group"> <script type="text/javascript"> jQuery(document).ready(function($) { $("#select-res").select2(); </script> <select class="form-control select" ng-model="displayName" id="select-res"> <option data-ng-repeat="objin objs" value="{{obj.displayName}}">{{obj.displayName}}</option> </select> <script> $('#select-res').select2().on('change', function(e) { var selectedval= $(this).val();...

ng-repeat filter by array of object only by specific properties

angularjs,search,angularjs-ng-repeat,angular-filters
I have an array of objects that I am ng-repeating over. I have a search box to filter results. Each object contains a variety of properties, some of which aren't relevant to the search filter. I'd like to limit the filter to only 2 of the properties. In the example...