我是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'], ...
但它不起作用。
有沒有辦法做到這一點?