Ui-sref and md-button. How it works?

2019-06-15 07:06发布

Example

Why menu item "Menu1" above the others if i add ui-sref ????

 <md-button  ui-sref="menu1" >Menu1</md-button>
 <md-button>Menu2</md-button>

3条回答
成全新的幸福
2楼-- · 2019-06-15 07:50

Better yet is to dispense with using two tags and specify 'md-button' as a class on the 'a' tag.

<a ui-sref="menu1" class="md-button">Menu1</a>

You can of course add any other material class tags too...

<a ui-sref="menu1" class="md-button md-raised md-primary">Menu1</a>
查看更多
爷、活的狠高调
3楼-- · 2019-06-15 07:52

If you are using ui-sref, then you should enclose it with Anchor tag.

<md-button><a ui-sref="menu1">Menu1</a></md-button>

As Hooligancat says, here is the updated Code:

<a ui-sref="menu1" class="md-button">Menu1</a>

Hope it works

查看更多
再贱就再见
4楼-- · 2019-06-15 08:07

It's actually better to wrap the button in the a tag. The problem with the recommended solution is that only the text acts as a link rather than the whole button, so I'd suggest;

<a ui-sref="menu1"><md-button>Menu1</md-button></a>
查看更多
登录 后发表回答