Javascript AngularJS ui.router更改页面并转到特定部分
我在应用程序中使用AngularJSJavascript AngularJS ui.router更改页面并转到特定部分,javascript,html,angularjs,angular-ui-router,Javascript,Html,Angularjs,Angular Ui Router,我在应用程序中使用AngularJSui.router。对于一个新用例,我想将视图从index.html更改为my partialview options.html。我的options.html有不同的部分 不同视图之间的布线工作正常,但我想更改视图并直接转到此视图上的部分 指从resources/html/index.html到resources/html/index.html#/options,带有特定部分 我有一个带有不同ui sref(一些用于测试)的下拉菜单,我想在那里调用视图和部分
ui.router
。对于一个新用例,我想将视图从index.html
更改为my partialview options.html。我的options.html
有不同的部分
不同视图之间的布线工作正常,但我想更改视图并直接转到此视图上的部分
指从resources/html/index.html
到resources/html/index.html#/options
,带有特定部分
我有一个带有不同ui sref
(一些用于测试)的下拉菜单,我想在那里调用视图和部分
index.html中的下拉菜单
<ul class="dropdown-menu">
<li>
<a ui-sref="home">Home</a> //works fine
<a ui-sref="options">Optionen</a> //works fine
<a ui-sref="options" scroll-to="option1">option1</a> //here should be the call of the view and section
</li>
</ul>
有人能解决这个问题吗
提前谢谢
编辑
如果我直接在浏览器中点击URLresources/html/index.html#/options#option2
,我会进入选项页面并进入正确的部分。但这是我不想要的 使用ui sref=“options”而不是不带点的ui sref=“.options”。这应该可以解决你的问题。这与我的情况没有区别。我来到“选项”页面,但不是直接指向我想要的部分。还有其他建议吗?还有其他建议吗?为什么你不能为你的两个部分使用两个不同的页面?因为我想要一个选项页面
,其中描述了不同的部分。它的工作原理应该类似于页面(指令下拉列表)。在我的应用程序中,如果我已经在我的选项页面上,它将起作用。但如果我不在选项页上,我想这样做。它就像Index.html->options.html->specific section
<section id="option1">
<div class="page-header">
<h1>option1</h1>
</div>
</section>
...
<section id="option2">
<div class="page-header">
<h1>option2</h1>
</div>
</section>
App.config(['$stateProvider', function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url : '/home',
templateUrl: 'home/homeLayout.html'
})
.state('options', {
url : '/options',
templateUrl: 'options/options.html'
});
}]);