angular.IRoute.controller can be defined as array

This commit is contained in:
Alex Tkachman
2016-02-11 10:14:09 +02:00
parent 1a5b2a729d
commit 80c19345b8
2 changed files with 11 additions and 1 deletions
+9
View File
@@ -1,3 +1,4 @@
/// <reference path="angular.d.ts" />
/// <reference path="angular-route.d.ts" />
/**
@@ -32,6 +33,14 @@ $routeProvider
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) => "" });
+2 -1
View File
@@ -47,6 +47,7 @@ declare module angular.route {
}
type InlineAnnotatedFunction = Function|Array<string|Function>
/**
* see http://docs.angularjs.org/api/ngRoute/provider/$routeProvider#when for API documentation
@@ -56,7 +57,7 @@ declare module angular.route {
* {(string|function()=}
* Controller fn that should be associated with newly created scope or the name of a registered controller if passed as a string.
*/
controller?: string|Function;
controller?: string|InlineAnnotatedFunction;
/**
* A controller alias name. If present the controller will be published to scope under the controllerAs name.
*/