Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 如何停止Angular ui router处理href_Angularjs_Angular Ui Router - Fatal编程技术网

Angularjs 如何停止Angular ui router处理href

Angularjs 如何停止Angular ui router处理href,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我已经收到了一堆html,需要将它们与web api提供的数据集成。我正在使用Angular,页面导航正在使用Angular ui路由器处理 我的问题是,我必须使用的代码包含很多这样的锚 <heading class="pageheader"> <a href="#step1" class="link-scroll">Scroll Down</a> ... bunch of stuff </heading> <di

我已经收到了一堆html,需要将它们与web api提供的数据集成。我正在使用Angular,页面导航正在使用Angular ui路由器处理

我的问题是,我必须使用的代码包含很多这样的锚

<heading class="pageheader">
    <a href="#step1" class="link-scroll">Scroll Down</a>
       ... bunch of stuff
 </heading>

 <div id="step1">
       ... more stuff
 </div>

... 一堆东西
... 更多的东西
我的问题是,不是触发javascript将页面向下滚动到step1 div中的数据输入内容,而是单击链接刷新页面,因此我返回主页视图

所以我想如果你这么做

<heading class="pageheader">
    <a ui-sref="state" href="#step1" class="link-scroll">Scroll Down</a>
       ... bunch of stuff
 </heading>

... 一堆东西
我停留在当前视图中,但是应该被触发以将页面向下滚动到步骤1的javascript从未被调用。。。。有什么简单的方法可以做到这一点吗


我可以通过将锚点更改为div并处理角度控制器中的点击来解决这个问题,但是html中有很多这样的东西我必须处理

似乎有一些

根据上述链接:

一种小型服务,用于在后台处理 自动滚动属性指令。如果您愿意,也可以使用它

当使用jqLite元素调用时,它会将元素滚动到视图中 (在
$timeout
之后,DOM有时间刷新)。如果你愿意 依靠
anchorScroll
将视图滚动到锚点,这可以是 通过调用
$uiViewScrollProvider.useAnchorScroll()
启用

据介绍,autoscroll也是一种选择。(文档中的示例)


似乎有一些

根据上述链接:

一种小型服务,用于在后台处理 自动滚动属性指令。如果您愿意,也可以使用它

当使用jqLite元素调用时,它会将元素滚动到视图中 (在
$timeout
之后,DOM有时间刷新)。如果你愿意 依靠
anchorScroll
将视图滚动到锚点,这可以是 通过调用
$uiViewScrollProvider.useAnchorScroll()
启用

据介绍,autoscroll也是一种选择。(文档中的示例)



您是想跳转到锚定位置,还是想先更改状态,然后再向下滚动到锚定位置?也许你找到了答案。你想跳转到一个锚,还是想先改变状态,然后再向下滚动到一个锚?也许你能找到答案。
<!-- If autoscroll unspecified, then scroll ui-view into view 
    (Note: this default behavior is under review and may be reversed) -->
<ui-view/>

<!-- If autoscroll present with no expression,
     then scroll ui-view into view -->
<ui-view autoscroll/>

<!-- If autoscroll present with valid expression,
     then scroll ui-view into view if expression evaluates to true -->
<ui-view autoscroll='true'/>
<ui-view autoscroll='false'/>
<ui-view autoscroll='scopeVariable'/>