AngularJS ui路由器视图未显示?
我有一个非常简单的appConfig:AngularJS ui路由器视图未显示?,angularjs,angular-ui-router,Angularjs,Angular Ui Router,我有一个非常简单的appConfig: var home = { name: 'home', url: '/home/' }; var homeAccess = { name: 'home.access', url: 'access', views: { 'home': { templateUrl: 'app/access/partials/webapi.html' } } }; 在my ind
var home = {
name: 'home',
url: '/home/'
};
var homeAccess = {
name: 'home.access',
url: 'access',
views: {
'home': {
templateUrl: 'app/access/partials/webapi.html'
}
}
};
在my index.html中,我有以下代码:
<div ui-view="home">home view here</div>
主视图在这里
但当我导航到主视图/访问时,我看到的只是“此处主视图”字样
任何人都能看到我的访问页面没有显示时可能出现的错误。根统计主目录需要未命名的查看目标-因此index.html应该包含它
//<div ui-view="home">home view here</div>
<div ui-view="">home view here</div>
检查此处的相似性:正如我在评论中所写,您只向我们展示了一些变量,但您需要更改
视图
部分:
var homeAccess = {
name: 'home.access',
url: 'access',
views: {
'home@': {
templateUrl: 'app/access/partials/webapi.html'
}
}
};
你有根用户界面视图吗?其他路线正在运行吗?控制台上有错误吗?正在加载webapi.html?这些只是一个变量,我们可以假设它们是您未包含在问题中的状态定义的一部分吗?@Alon-这些已包含在状态定义中。很抱歉,我只是在这里提供了一个片段。请您提供更多详细信息。问题可能出现在任何地方@JoãoMosmann-没有错误,我注意到webapi.html没有加载
var homeAccess = {
name: 'home.access',
url: 'access',
views: {
//'home': {
'home@': {
templateUrl: 'app/access/partials/webapi.html'
}
}
};
var homeAccess = {
name: 'home.access',
url: 'access',
views: {
'home@': {
templateUrl: 'app/access/partials/webapi.html'
}
}
};