我是AngularJs的新手,我正在学习一些教程来学习一些东西。如何配置不同的路径到同一个'controller'和'templateUrl'?
现在我正在处理路线。我的配置是类似的东西:
$routeProvider
.when('/',
{
controller: 'Controller1',
templateUrl: 'View1.html'
})
.when('/one',
{
controller: 'Controller1',
templateUrl: 'View1.html'
})
.when('/two',
{
controller: 'Controller2',
templateUrl: 'View2.html'
})
.otherwise({redirectTo: '/'});
现在我想知道,是有可能前两个.when
合并到一个单一的状况? 我试过类似:.when(['/', '/one'], ...
但它不起作用。
有没有办法做到这一点?