vishalaksh
vishalaksh

Reputation: 2154

How to execute angularjs directives in sequence?

I have 2 select directives:

 <select ng-model="selectedDistrict" ng-options="item.DISTRICT as item.DISTRICT for item in opendata  | unique: 'DISTRICT' "></select>
    <select ng-model="selectedYear" ng-options="item as item.YEAR for item in opendata | filter:{ DISTRICT: {{selectedDistrict}} }"></select>

The problem is that the second one gives error: Error: [$parse:syntax] Syntax Error: Token '}' not a primary expression at column 32 of the expression [opendata | filter:{ DISTRICT: }] starting at [}]

It is because selectedDistrict is not yet populated owing to the large size of opendata.

Is there a callback so that second directive can be fired once the first one has got the value?

Upvotes: 0

Views: 33

Answers (1)

JLRishe
JLRishe

Reputation: 101690

It is because selectedDistrict is not yet populated owing to the large size of opendata.

No, it is because you're using wonky syntax.

The correct syntax would be:

item as item.YEAR for item in opendata | filter: { DISTRICT: selectedDistrict }

Upvotes: 3

Related Questions