Paul Odeon Paul Odeon - 1 year ago 70
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>

Answer Source

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) { }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download