Skip to content

Instantly share code, notes, and snippets.

@mamged
Created June 23, 2016 11:48
Show Gist options
  • Save mamged/94b5770c2fc08432f9192a458e629085 to your computer and use it in GitHub Desktop.
Save mamged/94b5770c2fc08432f9192a458e629085 to your computer and use it in GitHub Desktop.
decorating angular material autocomplete, to extend it easily
angular.module('material.components.autocomplete').config(function ($provide) {
'use strict';
$provide.decorator('mdAutocompleteDirective', ['$delegate', function ($delegate) {
var directive = $delegate[0];
var link = directive.link;
directive.compile = function() {
return function(scope, element, attrs) {
link.apply(this, arguments);
var ctrl = scope.$mdAutocompleteCtrl; //cotroller
};
};
return $delegate;
}]);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment