简体   繁体   English

使用媒体查询和角度更改移动设备中ng-href的值

[英]Change the value of ng-href in mobile using media queries and angular

I have a button that I am trying to redirect to a different link on mobile than on desktop using angular. 我有一个按钮,尝试使用angular重定向到移动设备上而不是桌面上的其他链接。 Right now the link looks like this: 现在,链接看起来像这样:

    <a ng-href="{{ scheduler_link }}">
      Search area
    </a>

I'm not sure how to use media queries to change the value of scheduler_link on a smaller screen. 我不确定如何在较小的屏幕上使用媒体查询来更改scheduler_link的值。 How can I do this? 我怎样才能做到这一点?

As Far as I know you can't use media queries to change the actual value tied to that href. 据我所知,您不能使用媒体查询来更改与该href相关的实际值。 But what you could do is have two links and have one link visible at each media query. 但是您可以做的是有两个链接,并在每个媒体查询中看到一个链接。

<a class="linkOne" ng-href="{{ scheduler_link1 }}">
  Search area
</a>
<a class="linkTwo" ng-href="{{ scheduler_link2 }}">
   Search area
</a>

@media customMedia{
    .linkOne{
        visible: none; <---------cross-reference on me on this, my css is weak
    }
    .linkTwo{
        visible: yes;
    }
}

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

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