From 8b3bb6d8002185907ae6a3e12a913cb87dbe177e Mon Sep 17 00:00:00 2001 From: Chris Thielen Date: Sat, 14 May 2016 18:11:10 -0500 Subject: [PATCH] fix the fix for #2574 --- src/state.js | 3 ++- test/stateSpec.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/state.js b/src/state.js index a3fdb0045..cd56ebc4c 100644 --- a/src/state.js +++ b/src/state.js @@ -1469,11 +1469,12 @@ function $StateProvider( $urlRouterProvider, $urlMatcherFactory) { angular.module('ui.router.state') .factory('$stateParams', function () { return {}; }) + .constant("$state.runtime", { autoinject: true }) .provider('$state', $StateProvider) // Inject $state to initialize when entering runtime. #2574 .run(['$injector', function ($injector) { // Allow tests (stateSpec.js) to turn this off by defining this constant - if (!$injector.get("$noAutoInjectStateService")) { + if ($injector.get("$state.runtime").autoinject) { $injector.get('$state'); } }]); diff --git a/test/stateSpec.js b/test/stateSpec.js index 281ac9bcd..24553bae3 100644 --- a/test/stateSpec.js +++ b/test/stateSpec.js @@ -2,11 +2,11 @@ describe('state', function () { var stateProvider, locationProvider, templateParams, ctrlName, template; - angular.module('ui.router').constant("$noAutoInjectStateService", true); - beforeEach(module('ui.router', function($locationProvider) { + beforeEach(module('ui.router', ['$locationProvider', '$state.runtime', function($locationProvider, runtime) { locationProvider = $locationProvider; $locationProvider.html5Mode(false); - })); + runtime.autoinject = false; + }])); var log, logEvents, logEnterExit; function eventLogger(event, to, toParams, from, fromParams) {