Tags down


Filter Multiple Values using ngx-filter-pipe

By : bustered
Date : August 01 2020, 01:00 PM
Hope that helps The issue is with your filter.
The package expects the filter to be as below:
code :
const filter = {
  name: {
    $or: ['abc']
  age: {
    $or: ['17']

$or expects an Array.

Share : facebook icon twitter icon

How to implement filter by filter by search multiple property values in javascript?

By : qwerty
Date : March 29 2020, 07:55 AM
wish of those help You could iterate through the keys and return true for the filter if some value is found.
code :
var resData = [{ firstName: "Jhon", lastName: "adam", emailId: "jhn12@gmail.com" }, { firstName: "Kyle", lastName: "Miller", emailId: "kl12@gmail.com" }, { firstName: "Jhonathan", lastName: "adam", emailId: "jadm12@gmail.com" }, { firstName: "Lewis", lastName: "harber", emailId: "lewh12@gmail.com" }],
    self = { state: { inputValue: 'adam' } },
    result = resData.filter(function (item) {
        return Object.keys(item).some(function (k) {
            return item[k].toLowerCase().indexOf(self.state.inputValue.toLowerCase()) !== -1;
var resData = [{ firstName: "Jhon", lastName: "adam", emailId: "jhn12@gmail.com" }, { firstName: "Kyle", lastName: "Miller", emailId: "kl12@gmail.com" }, { firstName: "Jhonathan", lastName: "adam", emailId: "jadm12@gmail.com" }, { firstName: "Lewis", lastName: "harber", emailId: "lewh12@gmail.com" }],
    self = { state: { inputValue: 'adam' } },
    result = resData.filter(function (item) {
        return ['firstName', 'lastName'].some(function (k) {
            return item[k].toLowerCase().indexOf(self.state.inputValue.toLowerCase()) !== -1;

angular2 - pipe - filter multiple json values

By : Nader S. Ikladious
Date : March 29 2020, 07:55 AM
To fix this issue I have an array of nested json objects like this: , You can use OR operator when filtering.
code :
    name: 'search'
export class SearchPipe implements PipeTransform {
    transform(items: any[], args: string): any {
      if (!args){
        return items;
      } else {
        return items
          .filter(item => 
            item.name.en.toLowerCase().indexOf(args[0]) !== -1 || item.name.it.toLowerCase().indexOf(args[1]) !== -1 

Angular Material - Filter Table by multiple filters and multiple filter values at the same time

By : amuizzski
Date : March 29 2020, 07:55 AM
this will help You were on the right track with setting up the checkboxes and then using the model of the checkboxes to filter in the customFilterPredicate function.
code :
<mat-checkbox (change)="updateFilter()" [(ngModel)]="level.active" *ngFor="let level of levelsToShow">{{level.name}}</mat-checkbox>
export interface Level {
  active: boolean;
  name: string;
  level: number;
levelsToShow: Level[] = [
  { level: 1, active: false, name: 'Level 1' },
  { level: 2, active: false, name: 'Level 2' },
  { level: 3, active: false, name: 'Level 3' },
return data.name.toString().trim().toLowerCase().indexOf(searchString.name.toLowerCase()) !== -1 &&
        (this.levelsToShow.filter(level => !level.active).length === this.levelsToShow.length ||
         this.levelsToShow.filter(level => level.active).some(level => level.level === data.level));
updateFilter() {
  this.dataSource.filter = JSON.stringify(this.filteredValues);

angular filter pipe on multiple values of table columns

By : user2740394
Date : March 29 2020, 07:55 AM
wish of those help Your code logic bug is that you are returning true if any of the filters match when you want to only return true if all the filters match.
code :
transform(vList: any[], vfilter?: any): any {
  if (!vList || !Object.keys(vfilter).length) {
    return vList;
  return vList.filter(item => {
          return Object.keys(vfilter)
            .filter(_ => vfilter.hasOwnProperty(_))
            .every(key => {
              if(!item[key]) return true; // matches undefined value
              const arrayValues = vfilter[key] as any[];
              return arrayValues.some(_ => _ === item[key]);

Pipe to allow multiple filter values simultaneously - Angular

By : user3230545
Date : March 29 2020, 07:55 AM
I wish this help you There can be multiple ways to do that one would be to attach some property to determine if location is active for example isLocationActive
Then toggle this flag as per your need and to apply active class also you don't need filter pipe in that case
code :
<div class="form-group row">
  <div ngDefaultControl [(ngModel)]="filteredLocation" name="locationFilter" id="locationFilter">
        <button value="All" class="m-2 btn btn-primary" (click)="activeAllEntries()" type="button">All</button>
        <button [class.active]="entry.isLocationActive" (click)="entry.isLocationActive = !entry.isLocationActive" class="m-2 btn btn-primary" type="button" *ngFor="let entry of timeLine | filterUnique; let i = index">{{entry.location}}</button>

<div class="timeline">
  <ng-container *ngFor="let entry of timeLine">
<my-timeline-entry *ngIf="entry.isLocationActive" timeEntryHeader={{entry.year}} timeEntryContent={{entry.detail}} timeEntryPlace={{entry.place}} timeEntryLocation={{entry.location}}></my-timeline-entry>

   activeAllEntries() {
      this.timeLine.forEach(t=> t.isLocationActive=!t.isLocationActive)
Related Posts Related Posts :
  • How to add objects within another array of object at alternate position?
  • Integrate webSDK with jQuery Inside Vue Component?
  • How to set a value for a select options based on it's index number?
  • How to create new unique id every time in JavaScript?
  • How to merge and distribute the first array over the second one in JavaScript?
  • React js does not recognize me map method
  • React is setstate messing up my algorithm?
  • GAS: HtmlService.getUserAgent() returns null when using V8
  • How to pass parameters from one component to another in router.push() (Vue.js)?
  • How to convert single digit integer into double digit [Javascript]
  • how to input numbers using buttons in to a textbox
  • Nest can't resolve dependencies of custom service
  • Updating only one property inside an array of objects react
  • How to attribute value to jquery click function
  • Call 'created' function from 'methods' in VueJS after page is loaded
  • How to separate longitude and latitude from OpenLayers coordinates
  • how to filter data in specific days
  • How to call action in react before the first load of page?
  • How to add data validation list in excel using javascript
  • Binary addition algorithm using quotient and reminder
  • Need help to understand Vue.js function
  • Is there a way of running tests within testcafe without it automatically inserting local host infront of the URL
  • How to groupBy an attribute inside the second array with javascript
  • Scrapy only scraping the first two pages
  • JavaScript submits form despite return false statement
  • JavaScript Limit Drop Down Menu To Number In Input
  • JavaScript anonymous function parameters and calling arrangement
  • 'this' returns undefined in extended Classes in Javascript
  • Jquery validation error displayed on "label". How to fix it?
  • Firebase Analytics: Can I check if a Firebase Javascript Analytics event was logged before firebase updates?
  • Why doesn't the .remove() method also affect the variable it's being set on?
  • React hooks error: Rendered more hooks than during the previous render
  • How to create a completely new Keyword in JavaScript?
  • When summing values from 2 arrays how can I cap the value in the new array?
  • A pop up window to login in
  • How to push spacebar action to array
  • How do i highlight a specific table row depending on the url
  • Truly Weak Reference Event Emitter / Dispatcher: is it possible?
  • Conditionally render a a background image based on current view using React Router
  • Can not retrieve component template while routing
  • How to keep the checkbox status after refreshing the page
  • Array of Object - divide information as per values in it
  • Calculating body style height (for horizontal scroll) in javascript not working
  • How to exclude certain values from randomly generated array
  • Change colour of selected <li>
  • Formatting date object in an Array with moment is giving an unexpected result
  • combineLatest operator alternative
  • 'object' is never reassigned. Use 'const' instead
  • What does the spread operator in ES6 convert to in older JavaScript? Is it costlier than array.concat?
  • Get duplicates in array of strings and count number of duplicates
  • How to fix React Redux and React Hook useEffect has a missing dependency: 'dispatch'
  • Call a ajax request only if there are ajax requests added to the list
  • Using the jQuery each function to count divs with the same class
  • FInding out the Harshad number
  • angular route is not working and not changing current view
  • Callback executed before function finishes execution
  • How to create subfolder and document on Firestore web?
  • Scroll algorithm -- improving fetch and display of data
  • New To Programming World
  • Using mongorestore to insert many documents into a temp collection
  • shadow
    Privacy Policy - Terms - Contact Us © voile276.org