user91579631 user91579631 - 1 year ago 99
AngularJS Question

Hyperlink on angular material button does not cause browser to jump to that link

I am using angular material on angularjs v1.

I am having problems with a simple menu bar using angular material. Here is the html code for the menu bar;

<md-toolbar layout="row" class="md-whiteframe-z3" style="padding: 0px;margin:0px;float: left;">
<h2>Test page</h2>
<md-button href="Data1.html">Data1</md-button>
<md-button href="Data2.html">Data2</md-button>

enter image description here

When I click on
button, the browser URL changes to "" but the browser does not go to that webpage. I have to manually refresh the page to force the browser to go to that webpage.

How can I get the browser to go to that page when the button is pressed?

Answer Source

Use ng-href like this

 <md-button ng-href="{{googleUrl}}" target="_blank">Go to Google</md-button>


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