[英]ng-href does not work in a button. angularjs 1.7
<button ng-href="#!/edit/{{a.id}}"
type="button"
class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-edit"></span>
Edit
</button>
當我單擊按鈕時,什么也沒有發生。 但是它轉到我想要的鏈接,如果我使用
<a ng-href="#!/edit/{{a.id}}> Edit </a>
如何使用按鈕進行此路由? 謝謝
問題是<button>
元素不支持href
屬性。
您可以嘗試使用Bootstrap的類將<a>
元素設置為類似於按鈕的樣式。
<a ng-href="#!/edit/{{a.id}}"
class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-edit"></span>
Edit
</a>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.