Skip to content

Commit 8b3bb6d

Browse files
fix the fix for #2574
1 parent b00801c commit 8b3bb6d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: src/state.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1469,11 +1469,12 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) {
14691469

14701470
angular.module('ui.router.state')
14711471
.factory('$stateParams', function () { return {}; })
1472+
.constant("$state.runtime", { autoinject: true })
14721473
.provider('$state', $StateProvider)
14731474
// Inject $state to initialize when entering runtime. #2574
14741475
.run(['$injector', function ($injector) {
14751476
// Allow tests (stateSpec.js) to turn this off by defining this constant
1476-
if (!$injector.get("$noAutoInjectStateService")) {
1477+
if ($injector.get("$state.runtime").autoinject) {
14771478
$injector.get('$state');
14781479
}
14791480
}]);

Diff for: test/stateSpec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ describe('state', function () {
22

33
var stateProvider, locationProvider, templateParams, ctrlName, template;
44

5-
angular.module('ui.router').constant("$noAutoInjectStateService", true);
6-
beforeEach(module('ui.router', function($locationProvider) {
5+
beforeEach(module('ui.router', ['$locationProvider', '$state.runtime', function($locationProvider, runtime) {
76
locationProvider = $locationProvider;
87
$locationProvider.html5Mode(false);
9-
}));
8+
runtime.autoinject = false;
9+
}]));
1010

1111
var log, logEvents, logEnterExit;
1212
function eventLogger(event, to, toParams, from, fromParams) {

0 commit comments

Comments
 (0)