Hi J,

Isn't it simpler to have a subcomponent named 'action' and then add the 
verb you need as a parameter?
something like this:
  function actions() {
    return {
      template: buildTemplate,
    };

    function buildTemplate($element) {
      let action = $element[0].getAttribute('action');
      let html;
      switch (action) {
        case "one":
          html = '<button class="btn btn-primary">One</button>';
          break;
        case "two":
          html = '<button class="btn btn-default">two</button>';
          break;
        default:
          html = '<div>No valid action found</div>';
          break;
      }
      return html;
    }
  }

  angular.module('myPlunk', [])
    .component('myAction', actions());

demonstrated in this plunk 
<http://plnkr.co/edit/ZWcnmGVmMn4LOFTbBpSF?p=preview>.

Regards
Sander

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to