-1

I have implemented Bootstrap accordion(3.*.*) using Angular JS (1.2.*). Here I have used ui-router to load template when click each item in accordion. its working fine.

But I am getting the following error whenever click any item

Error: [$compile:nonassign] Expression '$state.includes('customers')' used with directive 'accordionGroup' is non-assignable!

I am getting the error in the below line. I have checked the following condition for opening the corresponding item whenever user click browser back button. How can i fix this?

is-open="$state.includes('customers')"

Also, I have checked the above condition in each item for 2 times. one for is-open. Another one for changing glyphicon in the right corner of each item. How can i reduce the code for this lengthy checking?

I want to fix the above issue inside view itself. I don't want to fix this from controller.

Here is a fiddle

Asik
  • 7,967
  • 4
  • 28
  • 34

1 Answers1

0

I have fixed this issue by assigning the active class in separate variable using ng-init

Working demo

ng-init="customersAccordionActive=$state.includes('customers');"

is-open="customersAccordionActive"
Asik
  • 7,967
  • 4
  • 28
  • 34