I have a button (an `a` tag) that appears many places on my site. It's called "View Demo", and in some cases it simply calls an `ui-sref` to navigate to a demo page:

```
<a class="btn btn-primary" ui-sref="hamburger-push" target="_blank">
   View Demo
</a>

```

which would be simple to make a directive out of, except in *some* cases it has an ng-click tied to the controller of the hosting page:

```
<a class="btn btn-primary" ng-click="mod.modals.basicMessage()">
  View Demo
</a>

```

So I am trying to make a directive which would have an atribute for each kind of link, and make those attributes optional. This way, when using the directive I can include the relevant one:

```
<view-demo-button clickaction="mod.modals.basicMessage()"></view-demo-button>

```

or

```
<view-demo-button linkaction="stateNameToGoTo"></view-demo-button>

```

To clarify, the button must be able to *either* 

1. Call a function on the host controller , or
2. Call $state.go in the host controller.

However, I can't get this right. My template is:

```
<div class="view-demo" >
  <a class="btn btn-primary" ng-if="ctrl.hasLink" ui-sref="{{ctrl.linkaction}}" target="_blank">
    View Demo
  </a>
  <a class="btn btn-primary" ng-if="ctrl.hasClick" ng-click="{{ctrl.clickaction}}" target="_blank">
    View Demo
  </a>
</div>

```

The directive is:

```
(function () {
  'use strict';

  angular.module('app').directive('viewDemoButton', function () {
    return {
      restrict: 'E',
      scope: {},
      bindToController: {
        'linkaction': '@?',
        'clickaction': '@?'
      },
      replace: true,
      templateUrl: 'core/directives/pb-view-demo-button.template.html',
      controller: function ($state) {
        var _this = this;

        _this.hasLink = _this.linkaction || false;
        _this.hasClick = _this.clickaction || false;

      },
      controllerAs: 'ctrl'
    };
  });
})();

```

Not sure if this is the correct approach or if this sort of thing even works. 

I made a [Plunker](http://plnkr.co/edit/ozHkrDA5jAVvRiVFxnBh?p=preview) of where it's at now, which is non-functional.