Skip to content

Commit

Permalink
fix the fix for #2574
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed May 14, 2016
1 parent b00801c commit 8b3bb6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/state.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}]);
6 changes: 3 additions & 3 deletions test/stateSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 8b3bb6d

Please sign in to comment.