Skip to content

Commit 64879a2

Browse files
refactor(ng1.router): BC-BREAK Change undocumented DI token from ng1UIRouter to $uiRouter
1 parent 2512282 commit 64879a2

File tree

2 files changed

+16
-15
lines changed

2 files changed

+16
-15
lines changed

src/ng1/services.ts

+14-14
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ app.run(runBlock);
158158

159159
let router: UIRouter = null;
160160

161-
ng1UIRouter.$inject = ['$locationProvider'];
161+
$uiRouter.$inject = ['$locationProvider'];
162162
/** This angular 1 provider instantiates a Router and exposes its services via the angular injector */
163-
function ng1UIRouter($locationProvider) {
163+
function $uiRouter($locationProvider) {
164164

165-
// Create a new instance of the Router when the ng1UIRouterProvider is initialized
165+
// Create a new instance of the Router when the $uiRouterProvider is initialized
166166
router = new UIRouter();
167167

168168
// Apply ng1 specific StateBuilder code for `views`, `resolve`, and `onExit/Retain/Enter` properties
@@ -211,17 +211,17 @@ function ng1UIRouter($locationProvider) {
211211
}
212212
}
213213

214-
function $stateParamsFactory(ng1UIRouter) {
215-
return ng1UIRouter.globals.params;
214+
function $stateParamsFactory($uiRouter) {
215+
return $uiRouter.globals.params;
216216
}
217217

218218
// The 'ui.router' ng1 module depends on 'ui.router.init' module.
219-
angular.module('ui.router.init', []).provider("ng1UIRouter", <any> ng1UIRouter);
219+
angular.module('ui.router.init', []).provider("$uiRouter", <any> $uiRouter);
220220
// This effectively calls $get() to init when we enter runtime
221-
angular.module('ui.router.init').run(['ng1UIRouter', function(ng1UIRouter) { }]);
221+
angular.module('ui.router.init').run(['$uiRouter', function($uiRouter) { }]);
222222

223223
// $urlMatcherFactory service and $urlMatcherFactoryProvider
224-
angular.module('ui.router.util').provider('$urlMatcherFactory', ['ng1UIRouterProvider', () => router.urlMatcherFactory]);
224+
angular.module('ui.router.util').provider('$urlMatcherFactory', ['$uiRouterProvider', () => router.urlMatcherFactory]);
225225
angular.module('ui.router.util').run(['$urlMatcherFactory', function($urlMatcherFactory) { }]);
226226

227227
// $urlRouter service and $urlRouterProvider
@@ -233,7 +233,7 @@ function getUrlRouterProvider() {
233233
};
234234
return router.urlRouterProvider;
235235
}
236-
angular.module('ui.router.router').provider('$urlRouter', ['ng1UIRouterProvider', getUrlRouterProvider]);
236+
angular.module('ui.router.router').provider('$urlRouter', ['$uiRouterProvider', getUrlRouterProvider]);
237237
angular.module('ui.router.router').run(['$urlRouter', function($urlRouter) { }]);
238238

239239
// $state service and $stateProvider
@@ -246,22 +246,22 @@ function getStateProvider() {
246246
};
247247
return router.stateProvider;
248248
}
249-
angular.module('ui.router.state').provider('$state', ['ng1UIRouterProvider', getStateProvider]);
249+
angular.module('ui.router.state').provider('$state', ['$uiRouterProvider', getStateProvider]);
250250
angular.module('ui.router.state').run(['$state', function($state) { }]);
251251

252252
// $stateParams service
253-
angular.module('ui.router.state').factory('$stateParams', ['ng1UIRouter', (ng1UIRouter) =>
254-
ng1UIRouter.globals.params]);
253+
angular.module('ui.router.state').factory('$stateParams', ['$uiRouter', ($uiRouter) =>
254+
$uiRouter.globals.params]);
255255

256256
// $transitions service and $transitionsProvider
257257
function getTransitionsProvider() {
258258
router.transitionService["$get"] = () => router.transitionService;
259259
return router.transitionService;
260260
}
261-
angular.module('ui.router.state').provider('$transitions', ['ng1UIRouterProvider', getTransitionsProvider]);
261+
angular.module('ui.router.state').provider('$transitions', ['$uiRouterProvider', getTransitionsProvider]);
262262

263263
// $templateFactory service
264-
angular.module('ui.router.util').factory('$templateFactory', ['ng1UIRouter', () => new TemplateFactory()]);
264+
angular.module('ui.router.util').factory('$templateFactory', ['$uiRouter', () => new TemplateFactory()]);
265265

266266
// The $view service
267267
angular.module('ui.router').factory('$view', () => router.viewService);

src/params/paramTypes.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {isDefined} from "../common/predicates";
44
import {is, val} from "../common/hof";
55
import {services} from "../common/coreservices";
66
import {ParamType} from "./type";
7+
import {ParamTypeDefinition} from "./interface";
78

89
// Use tildes to pre-encode slashes.
910
// If the slashes are simply URLEncoded, the browser can choose to pre-decode them,
@@ -85,7 +86,7 @@ export class ParamTypes {
8586
this.types = inherit(map(this.defaultTypes, makeType), {});
8687
}
8788

88-
type(name, definition?: any, definitionFn?: Function) {
89+
type(name, definition?: ParamTypeDefinition, definitionFn?: () => ParamTypeDefinition) {
8990
if (!isDefined(definition)) return this.types[name];
9091
if (this.types.hasOwnProperty(name)) throw new Error(`A type named '${name}' has already been defined.`);
9192

0 commit comments

Comments
 (0)