Saqib Ali Saqib Ali - 1 year ago 93
AngularJS Question

How to get AngularJS link to look/act like a Button?

I have the following code in my AngularJS template:

<button class="submit-button" ng-click="myCtrl.doSomething1()">
Do Something 1
<a class="submit-button" ui-sref="mystate({param1: 'a', param2: 'b'})">Do Something 2</a>

Here is the style:

.submit-button {
color: black;
font-weight: bold;
text-align: center;

This is how it gets rendered:

enter image description here

I would like
Do Something 2
to also appear and act as a button, just like
Do Something1
. But when clicked, it should send the user to the state specified in the
. How can I do it?

Answer Source

enclose in button tag

 <a ui-sref="mystate({param1: 'a', param2: 'b'})"><button class="submit-button">test</button></a>

Example using button as outer div and anchor tag as outer div

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download