Roberto
Roberto

Reputation: 135

Disable select option with angular ng-options

following the angular documentation

ng-options guidelines

I write that part of code:

<select ng-model="model" ng-options="item.CODE as item.NAME disable when item.DISABLE for item in list" id="foo" name="foo" ng-change="change()">

but return me back this error:

Syntax Error: Token 'disable' is an unexpected token at column 11 of the expression [{3}] starting at [{4}].

What I'm doing wrong?

Upvotes: 1

Views: 2139

Answers (2)

Vineet Desai
Vineet Desai

Reputation: 932

Try updating the angular.js version. This functionality was added in version 1.4.X and above.

Upvotes: 1

Jenish Rabadiya
Jenish Rabadiya

Reputation: 6766

You are referring to wrong syntax. For disable with array there is only two syntax available.

  1. label disable when disable for value in array
  2. label disable when disable for value in array track by trackexpr

Try out following:

<select ng-model="model" ng-options="item.CODE disable when item.DISABLE for item in list" id="foo" name="foo" ng-change="change()">

Upvotes: 2

Related Questions