我使用 AngularJSui.router
在我的应用程序中。对于新的用例,我想更改视图index.html
到我的partialview options.html。我的options.html
有不同的部分。
不同视图之间的路由工作正常,但我想更改视图并直接转到section
就这个观点而言。
意思是来自resources/html/index.html
to 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>
options.html 包含一些部分
<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.js
App.config(['$stateProvider', function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('home', {
url : '/home',
templateUrl: 'home/homeLayout.html'
})
.state('options', {
url : '/options',
templateUrl: 'options/options.html'
});
}]);
有人有解决方案吗?
提前致谢。
EDIT
如果我点击 URLresources/html/index.html#/options#option2
直接在浏览器中,我进入选项页面和正确的部分。但这是我不想要的。