本文整理匯總了TypeScript中angular-ui-router.IUrlRouterProvider.otherwise方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript IUrlRouterProvider.otherwise方法的具體用法?TypeScript IUrlRouterProvider.otherwise怎麽用?TypeScript IUrlRouterProvider.otherwise使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular-ui-router.IUrlRouterProvider
的用法示例。
在下文中一共展示了IUrlRouterProvider.otherwise方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
function($stateProvider: IStateProvider,
$urlRouterProvider: IUrlRouterProvider) {
// App Routing
$urlRouterProvider.otherwise('/dashboard');
if(CONSTANTS.atlas.ui.frontendOnly){
$stateProvider
.state('dashboard', {
url: '/dashboard',
template: '<dashboard></dashboard>',
data: {
menu: {
name: 'Dashboard',
icon: 'fa-dashboard'
}
}
})
// .state('page3', {
// url: '/page3',
// template: '<page3></page3>',
// data: {
// menu: {
// name: 'Localization',
// icon: 'fa-calculator'
// }
// }
// });
}}]);
示例2: function
.config(["$urlRouterProvider", "$stateProvider", function (route: IUrlRouterProvider, stateProvider: IStateProvider) {
route.otherwise("/state1/");
stateProvider
.state("state1", {
url: "/state1/:detail",
templateUrl: "app/view1/view1.html",
controller: "View1Controller as vm"
})
.state("state2", {
url: "/state2",
templateUrl: "app/view2/view2.html",
controller: View2Controller,
})
.state("state3", {
url: "/state3/:detail/:viewId",
templateUrl: "app/view1/view1.html",
controller: "View1Controller as vm"// same view as View1
})
.state("state4", {
url: "/state4",
template: "<some-component></some-component>",
});
}]);
示例3: routes
export function routes($stateProvider: IStateProvider, $urlRouterProvider: IUrlRouterProvider) {
$stateProvider
.state('app', {
url: '/app',
abstract: true,
template: require('./App/app.html')
});
$urlRouterProvider.otherwise('/app/language');
}
示例4: routeConfig
function routeConfig($stateProvider: IStateProvider,
$urlRouterProvider: IUrlRouterProvider) {
$stateProvider
.state('login', {
url: '/login',
controller: 'LoginController as ctrl',
templateUrl: 'login/login.html'
})
$urlRouterProvider.otherwise('/login');
}
示例5: constructor
constructor($stateProvider: IStateProvider, $urlRouterProvider: IUrlRouterProvider){
$urlRouterProvider.otherwise("/products");
$stateProvider
.state("products", {
url: "/products",
template: "<app-product-list></app-product-list>"
})
.state("productDetails", {
url: "/product/:id",
template: "<app-product></app-product>"
});
}
示例6:
export const Routes = (
$stateProvider: IStateProvider,
$urlRouterProvider: IUrlRouterProvider
) => {
'ngInject'
$urlRouterProvider.otherwise('/phones');
$stateProvider
.state('phones', {
url: '/phones',
template: '<phone-list></phone-list>'
})
.state('phoneDetail', {
url: '/phones/:phoneId',
template: '<phone-detail></phone-detail>'
})
}
示例7: registerRoutes
export function registerRoutes($stateProvider: IStateProvider,
$urlRouterProvider: IUrlRouterProvider,
$locationProvider: ILocationProvider){
$urlRouterProvider.otherwise("/home");
$stateProvider
.state('home', {
url: "/home",
template: `<tar-home></tar-home>`
})
.state('about', {
url: "/about",
template: `<tar-about></tar-about>`
});
$locationProvider.html5Mode(true);
}
示例8: function
angular.module('app').config(function ($stateProvider: IStateProvider , $urlRouterProvider: IUrlRouterProvider) {
$urlRouterProvider.otherwise('lost');
return $stateProvider
.state('first', {
url : '',
templateUrl: 'views/home.html'
})
.state('home', {
url : '/',
// templateUrl: 'views/home.html'
template: '<home></home>'
})
.state('lost', {
url : '/lost',
templateUrl: 'views/lost.html',
controller: function($scope, $state) {
$scope.state = $state;
}
})
.state('member list', {
url : '/memberEnumeration',
templateUrl: 'views/memberList.html'
})
.state('member', {
url : '/members/:memberId',
// controller : 'memberCtr',
// controllerAs: 'vm',
// templateUrl : 'views/memberView.html'
template: '<member></member>'
})
.state('member grid', {
url : '/memberGrid',
templateUrl: 'views/memberGrid.html'
})
.state('map', {
url : '/map',
templateUrl: 'views/map.html'
});
});
示例9: router
export function router($stateProvider:IStateProvider, $locationProvider:ILocationProvider, $urlRouterProvider:IUrlRouterProvider) {
$locationProvider.html5Mode(true);
// $locationProvider.hashPrefix('!');
$urlRouterProvider.otherwise('/');
// ACCOUNT
$stateProvider.state('login', {
url: '/login',
views: {
'master': {
templateUrl: 'tpl/account/login.html',
controller: 'loginController',
controllerAs: 'vm'
}
}
});
// The Rest
$stateProvider.state('home', {
url: '/',
views: {
'master': {
templateUrl: 'tpl/home.html',
controller: 'homeController',
controllerAs: 'vm'
}
}
});
$stateProvider.state('about', {
url: '/about',
views: {
'master': {
templateUrl: 'tpl/about.html',
controller: 'aboutController',
controllerAs: 'vm'
}
}
});
///<vesta:ngRouter/>
}
示例10:
app.config(function ($stateProvider: IStateProvider, $urlRouterProvider: IUrlRouterProvider) {
$urlRouterProvider.otherwise("/home");
$stateProvider.state('home', {
url: '/home',
template: '<home></home>'
})
.state('flightBooking', {
abstract: true,
data: {
protected: true
},
url: '/flightBooking',
template: '<flight-booking></flight-booking>',
})
.state('flightBooking.passengerSearch', {
url: '/passenger',
template: '<passenger-search></passenger-search>',
data: {
protected: true
}
}).state('flightBooking.flightSearch', {
url: '/flight',
template: '<flight-search></flight-search>',
data: {
protected: true
}
}).state('flightBooking.flightEdit', {
url: '/flight/:id',
template: '<flight-edit></flight-edit>',
data: {
protected: true
}
});
});