【发布时间】:2015-06-25 11:42:19
【问题描述】:
我想在单击我的菜单的菜单项时加载一个页面,但状态会反映到我的浏览器 URL 中,并且该页面的内容没有被加载,据我研究教程状态是只有这样声明,我的代码也没有显示任何错误。
这是我的 route.js 文件
app.config(function config($stateProvider)
{
$stateProvider.state("index",{
url:"",
controller:"MainCtrl",
templateUrl:"templates/home/home.html"
}),
$stateProvider.state("development",{
controller:"EmployeeCtrl",
templateUrl:"templates/employee/employee.html"
});
})
这是我在其href 的主页上的列表,我已声明我的索引状态工作正常。
<ul class="nav navbar-nav">
<li class="active"><a href="#/development">Development</a></li>
<li><a href="#/design">Design</a></li>
<li><a href="#/exercise">Exercise</a></li>
<li><a href="#/humor">Humor</a></li>
</ul>
这是页面employee.html的代码,当开发状态完成时我想显示其内容。
<div>
<input type="text" ng-model="searchText">
<table>
<tr ng-repeat="emp in employee.data | filter:searchText"></tr>
<td>{{emp.firstname}}</td>
<td>{{emp.lastname}}</td>
</table>
</div>
【问题讨论】:
-
你能创建一个 plunker 吗?
-
你试过
ui-sref吗? -
@Anky 你看过我的答案了吗?
-
是的 @pankaj 完成了
标签: javascript angularjs routing angular-ui-router angularjs-routing