我将如何使用链接来触发 ng-switch?
我当前的html:
<ul class="nav nav-list bs-docs-sidenav affix sidenav">
<li><a href="#" ng-click="page='resources'">Resources</a></li>
<li><a href="#" ng-click="page='users'">Users</a></li>
</ul>
<div ng-switch on="page">
<div ng-switch-when="resources">
<h1>resources Div</h1>
</div>
<div ng-switch-when="users">
<h1>Users</h1>
</div>
<div ng-switch-default>
<h1>Default</h1>
</div>
</div>
我的控制器:
function Ctrl($scope) {
$scope.page = 'users';
}
我错过了什么?