Last active
August 29, 2015 14:03
-
-
Save Xanir/ac55fd3065904b6c06cf to your computer and use it in GitHub Desktop.
AutoComplete Grouping Directive
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use in row template for AutoComplete hints. | |
module.directive('grouping', function($timeout) { | |
return { | |
restrict: 'AE', | |
link: function (scope, element, attr) { | |
$timeout(function() { | |
var groupClass = scope.groupClass; | |
var groupLabel = scope.groupLabel; | |
var newElem = angular.element('<div class="' + groupClass + '">' + groupLabel + '</div>'); | |
var parentElem = angular.element(element.parent()); | |
parentElem.after(newElem); | |
newElem.after(parentElem); | |
}, 0, false); | |
} | |
}; | |
}); | |
Related CSS: | |
.groupClass ~ .groupClass { | |
display: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment