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

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

jsf - "PropertyNotWritableException: Illegal Syntax for Set Operation" error when setting value in bean -

arrays - Algorithm to find ideal starting spot in a circle -