when selecting second dropdown ng-model object return null

When I making dropdown selection, my ng-model object becomes null, not sure why. Because it … Read more when selecting second dropdown ng-model object return null

When I making dropdown selection, my ng-model object becomes null, not sure why.

Because it returns null I getting below error:

 TypeError: Cannot read properties of null (reading 'name')

My code

<select ng-options="option.name for option in $ctrl.getAvailableColumnOptions()" ng-model="$ctrl.secondColumnOption"></select>
<select ng-options="option.name for option in $ctrl.getAvailableColumnOptions()" ng-model="$ctrl.thirdColumnOption"> </select>


getAvailableColumnOptions(){
      return this.allAvailableColumnOptions.filter(x => x.name !== this.secondColumnOption.name && x.name !== this.thirdColumnOption.name && x.name !== this.fourthColumnOption.name);
}

Source: JavaSript – Stack Overflow



Leave a Reply

Your email address will not be published. Required fields are marked *