Reputation: 199
I have issue - create orders with different properties. In my work case user have about 10 different properties and 3-4 variants for each property.
I'm using angular js, and wrote two functions:
Setter
$scope.attribute = function(key, value) {
$scope.order[key] = value;
};
Watcher for ng-class
$scope.isActive = function(key, value) {
return ($scope.order[key] == value) ? 'active' : '';
}
Simplified demo is here: http://jsfiddle.net/ec6eo8us/1/
Demo above works great, but in my real project, in many cases when I set property %x% other properties lose class "active". Sometimes, it works correct, but mostly user don't see which options is active (in model $scope.order correct data, problems is with class).
Do you have any ideas why it happens? Why it works in my demo example? May it depends on count of properties?
Thanks on advance.
Upvotes: 0
Views: 216
Reputation: 199
Found the problem. I'm using bootstrap and there was attribute data-toggle="button", so it made conflict between bootstrap functionality and ng-class.
Upvotes: 1