html - Filter pipe does not effect ngModel value -


i'm trying create 2 select dropboxes 1 filters other in angular.

1st select:

<select [(ngmodel)]="selectedoption1">   <option *ngfor="let option of options1" [ngvalue]="option.value">     {{option.description}}   </option> </select> 

2nd select:

 <select [(ngmodel)]="selectedoption2">    <option *ngfor="let option of options2 | filteroption2byoption1:selectedoption1"             [ngvalue]="option.value">             {{option.category2name}}    </option>  </select> 

options1:

options1 = [{    description:"option 1-1",    value:1   },   {    description:"option 1-2",    value:2   }] 

options2:

options2 = [{    option1value:1,    description:"option 2-1",    value:1   },   {    option1value:2,    description:"option 2-2",    value:2   }] 

pipe looks this:

@pipe({   name: 'filteroption2byoption1' }) export class filteroption2byoption1 implements pipetransform {   transform(options2: any, option1value: number): {   if(option1value !== null && option1value !== undefined){    return options2.filter(option => option.option1value == option1value)   }   return null;  } } 

what doesn't seems work after filter magic ngmodel not change.

click event nor [ngmodelchange] triggered if trying add them 2nd select.

the pipe works fine. problem ngmodel not effected it.


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -