forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular-route-tests.ts
49 lines (45 loc) · 1.58 KB
/
angular-route-tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/// <reference path="angular.d.ts" />
/// <reference path="angular-route.d.ts" />
/**
* @license HTTP Auth Interceptor Module for AngularJS
* (c) 2013 Jonathan Park @ Daptiv Solutions Inc
* License: MIT
*/
declare var $routeProvider: ng.route.IRouteProvider;
$routeProvider
.when('/projects/:projectId/dashboard', {
controller: 'I am a string',
templateUrl: "So am I",
caseInsensitiveMatch: true,
reloadOnSearch: false
})
.when('/projects/:projectId/dashboard2', {
controller: function () {
//Look at me - I'm a function!
},
template: function ($routeParams?: ng.route.IRouteParamsService) {
return "I return a string"
}
})
.when('/projects/:projectId/dashboard3', {
controllerAs: 'I am a string',
template: "Yup. String"
})
.when('/projects/:projectId/dashboard4', {
controller: 'I am a string',
templateUrl: function ($routeParams?: ng.route.IRouteParamsService) {
return "I return a string"
}
})
.when('/projects/:projectId/dashboard5', {
controller: ['$log',function($log:ng.ILogService){
$log.info('I am array')
}],
templateUrl: function ($routeParams?: ng.route.IRouteParamsService) {
return "I return a string"
}
})
.otherwise({ redirectTo: '/' })
.otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" });
var current: ng.route.ICurrentRoute;
current.locals['test-key'] = 'test-value';