From 80c19345b84626c404ecc1bdc68c7ee6297b4f7f Mon Sep 17 00:00:00 2001 From: Alex Tkachman Date: Wed, 10 Feb 2016 14:08:52 +0200 Subject: [PATCH] angular.IRoute.controller can be defined as array --- angularjs/angular-route-tests.ts | 9 +++++++++ angularjs/angular-route.d.ts | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/angularjs/angular-route-tests.ts b/angularjs/angular-route-tests.ts index 0260359fb..ab5fba0b6 100644 --- a/angularjs/angular-route-tests.ts +++ b/angularjs/angular-route-tests.ts @@ -1,3 +1,4 @@ +/// /// /** @@ -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) => "" }); diff --git a/angularjs/angular-route.d.ts b/angularjs/angular-route.d.ts index eafdf714c..ec49b3cd9 100644 --- a/angularjs/angular-route.d.ts +++ b/angularjs/angular-route.d.ts @@ -47,6 +47,7 @@ declare module angular.route { } + type InlineAnnotatedFunction = Function|Array /** * 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. */