Paul Odeon Paul Odeon - 3 months ago 14
AngularJS Question

Angular directive to match multiple attributes

Can I define an angular directive so that it would match multiple similar terms

angular.module('search').directive('platformPreload', function() {
return {
link: function(scope, element, attrs) {

Would match both the following:

<div platform-preload-terms="[]"></div>
<div platform-preload-suggestions="[]"></div>


There are no wildcard directive declaration.

But you can isolate the function and repeat the definition:

    .directive('platformPreload', PlatFunction)
    .directive('platformPreloadSuggestions', PlatFunction)

PlatFunction() {
    return {
        link: function(scope, element, attrs) { }