I have a html snippet that I'm now having to duplicate a lot which brings me to my question as I'd like to make the html snippet into a directive that can be reused. I'd like to transform the snippet below into a directive.
<a href="#" ng-click="vm.orderBy ='UserName'; reverseSort = !reverseSort"> User Name <span ng-show="vm.orderBy == 'UserName'"> <span ng-show="!reverseSort"><i class="fa fa-sort-alpha-asc"></i></span> <span ng-show="reverseSort"><i class="fa fa-sort-alpha-desc"></i></span> </span> </a> What I'd like is a directive that allows me to pass any string property to the orderBy field which would make it dynamic. so something like <my-directive sort = 'Username'></my-directive> I have vm.orderBy = '' initialised in my main controller.