-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Since a ngClass is already present in the uiSelect theme templates, we could not add any ngClass on <ui-select> without getting an JS error Currently, adding a ngClass on <ui-select> result in: `ng-class="{class: expression} {open: $select.open}"` With this fix, doing the same thing result in: `ng-class="{class: expression, open: $select.open}"` Closes angular-ui#277
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,14 @@ uis.directive('uiSelect', | |
controllerAs: '$select', | ||
compile: function(tElement, tAttrs) { | ||
|
||
// Allow setting ngClass on uiSelect | ||
var match = /{(.*)}\s*{(.*)}/.exec(tAttrs.ngClass); | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Magador
Owner
|
||
if(match) { | ||
var combined = '{'+ match[1] +', '+ match[2] +'}'; | ||
tAttrs.ngClass = combined; | ||
tElement.attr('ng-class', combined); | ||
} | ||
|
||
//Multiple or Single depending if multiple attribute presence | ||
if (angular.isDefined(tAttrs.multiple)) | ||
tElement.append('<ui-select-multiple/>').removeAttr('multiple'); | ||
|
2 comments
on commit 6a99b08
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right on, I've merged it in for the next release!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Using .exec is not ideal. Can this fix be achieved with directive priority instead?