我只想首先说一下我查看了与此问题相关的堆栈溢出问题,因为我能找到并且我没有看到任何关于我遇到的问题的问题.有些相似,但不是真的.这是问题:
我有以下$ stateProvider设置:
$stateProvider.
state('root', {
url: '',
views: {
'ViewA': {
templateUrl: 'ViewA.html',
controller: ViewAController
},
'ViewB': {
templateUrl: 'ViewB.html',
controller: ViewBController
},
'ViewC': {
templateUrl: 'ViewC.html',
controller: ViewCContoller
}
}
});
Run Code Online (Sandbox Code Playgroud)
以下是与它一起使用的index.Html:
<head>
<title>Angular PoC</title>
</head>
<body ng-controller="DashboardController">
<!-- Account View for logging in -->
<div ui-view="ViewA" ng-hide="currentlyLoggedIn"></div>
<!-- Used to toggle the two main views -->
<div ng-show="currentlyLoggedIn">
<button ng-click="activateViewB()"> View B </button>
<button ng-click="activateViewC()"> View C </button>
</div>
<!-- These are the two main views --> …Run Code Online (Sandbox Code Playgroud)