angular - Object change detection in array -


i need manually (or automatically) change detect property of object in array. have array of productshops entity in ngfor loop filtered "isnotdeleted" property. when change value of isnotdeleted property angular not detect change.

<ul class="nav nav-tabs">     <li *ngfor="let productshop of product.productshops | filter:'isnotdeleted':true" >         <a href="#categoryassoctab{{productshop.shop.id}}" data-toggle="tab">{{productshop.shop.name}}</a>     </li> </ul> 

edit: pipe implementation:

import {pipe, pipetransform} "@angular/core";  @pipe({     name: 'filter' }) export class filterpipe implements pipetransform{      transform(value:array<any>, property, equal){          let properties = property.split('.')          if(value){             return value.filter(item => {                  let finalvalue:any = item                  properties.foreach(p => {                     finalvalue = finalvalue[p]                 })                  return finalvalue == equal             })         }          return []     }  } 

your pipe should marked not pure, because result of transformation given input can change though input hasn't changed.

@pipe({     name: 'filter',     pure: false }) 

see


Comments

Popular posts from this blog

php - Autoloader issue not returning Class -

C++ Program To Find Smallest and Largest Number In Array -

java - How to put two numbers separated by a space into two different arrays -