Do something like this using ng-href
First change the button to the anchor and add the ng-href attribute;
<a href ng-href="{{ href }}" id="single-button" class="btn btn-primary" uib-dropdown-toggle ng-disabled="disabled"> {{ name }} <span class="caret"></span> </a>
Then change the actions variable to store an array of objects:
$scope.actions = [ { name: 'Action', href: 'action.html' }, { name: 'Another Action', href: 'another_action.html' }, { name: 'Something else here', href: 'something_else_here.html' } ];
Then finally change the change function to update the action name and href
$scope.change = function(action){ $scope.name = action.name; $scope.href = action.href; }
EDIT Now with the CodePen example . Please note that I changed the button to a split button (otherwise href will not be used at all, because it will be overwritten by the switch).
source share