I have a dynamically populated accordion that updates every 15 seconds. I need to keep track of the last opened accordion group as the dataList can be very large and parsing it for each update is not feasible.
Below is the code snippet from my HTML file:
<accordion-group ng-repeat="data in dataList" is-open="isAccordionOpen(data.dataName)">
<accordion-heading>
<span ng-click="openedAccordionGroup(data.dataName)" class="accordionSpan"><b>{{data.dataName}}</b></span>
</accordion-heading>
</accordion-group>
And here is the corresponding JavaScript code:
$scope.openedAccordionName = '';
$scope.isAccordionOpen = function(name){
return $scope.openedAccordionName === name;
};
$scope.openedAccordionGroup = function(name) {
$scope.openedAccordionName = name;
};
However, when I run this code, I encounter a JavaScript error:
Error: [$compile:nonassign] Expression 'isAccordionOpen(data.dataName)' used with directive 'accordionGroup' is non-assignable!
What am I doing wrong in the above code?