简体   繁体   English

Angular Material无法将md卡设置为锚点

[英]Angular Material can't set md-card as an anchor

是否可以使整个卡成为Angular材质的链接,还是针对该用例准备了另一个指令?

You can just put a ng-click on the card and perform your operation.Further you can style the card with hover effects to get the feel of a link.Like this : 您只需在卡上进行ng-click执行操作,此外,您还可以使用悬停效果对卡进行样式设置以获得链接的感觉。

HTML: HTML:

<md-card ng-click="cardSelected()" class="cardAsLink">
      ....
</md-card>

JS: JS:

$scope.cardSelected=function(){
  console.log("card Clicked");
}

CSS: CSS:

.cardAsLink{
  cursor: pointer;
}

.cardAsLink:hover{
  border : 1px solid blue;
}

Yes you can put an anchor tag around the card. 是的,您可以在卡片周围放置锚标签。 I think it is the better solution because you have the hole functionality of the anchor tag. 我认为这是更好的解决方案,因为您具有锚标记的孔功能。 In Ramblers answer clicking would work fine and if you use the the router the historie would also be korrect, but thinks like clicking with the mouse wheel to open a new tap would not work. 在“漫步者”中,单击将可以正常工作,如果您使用路由器,则历史记录也将是正确的,但您认为用鼠标滚轮单击以打开新的点击将不起作用。 The same goes for right mouse click thinks and the navigation preview on the bottom of the browser would also be missing. 右键单击的想法也是如此,浏览器底部的导航预览也将丢失。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM