Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

angular ui router creates error messages with angular 1.6.0 #3120

Closed
david-gang opened this issue Nov 1, 2016 · 24 comments
Closed

angular ui router creates error messages with angular 1.6.0 #3120

david-gang opened this issue Nov 1, 2016 · 24 comments

Comments

@david-gang
Copy link

Hi all,

At lines https://github.com/angular-ui/ui-router/blob/legacy/release/angular-ui-router.js#L2904-L2907 we use $q.reject.

Due to a breaking change in angular 1.6.0 (https://github.com/angular/angular.js/blob/master/CHANGELOG.md)
(I think this is angular/angular.js@e13eeab) there are error messages sent to the console.

angular.js:14239 Possibly unhandled rejection: {}

Thanks,

@christopherthielen
Copy link
Contributor

Fixed in 0.3.2 by 66ab048

@christopherthielen
Copy link
Contributor

christopherthielen commented Jan 10, 2017

As my previous comment says, this should be fixed in 0.3.2 0.4.2 (and 1.0)

@Steve-Mc
Copy link

Still seeing this in 0.3.2

@ndpdarshana
Copy link

ndpdarshana commented Jan 20, 2017

I'm also seen this in 0.3.2.

It's seems to be appear when $state is use as conditional manner
if(authService.validate()){
$state.go('home.dashboard');
}else{
$state.go('login');
}

@christopherthielen
Copy link
Contributor

Update to 0.4.1 or 1.0

@dashawk
Copy link

dashawk commented Feb 14, 2017

Still having some issues.

with
Angular 1.6.2
Angular-ui-router 0.4.2

@bkinsey808
Copy link

upgrading to 0.4.2 fixed this issue for me (with angular 1.6.2)

@dashawk
Copy link

dashawk commented Feb 15, 2017

I got "transition prevented" error. with these versions.

@greatsayan
Copy link

greatsayan commented Feb 24, 2017

I got an error too.
Angular 1.6.2 with ui-router 0.4.2

The problem seems coming from the ui-sref

TypeError: g.get is not a function
at R.controller.$$addStateInfo

@johnnynode
Copy link

same here!

Error: transition superseded
    at $StateProvider.$get (http://127.0.0.1:9000/bower_components/angular-ui-router/release/angular-ui-router.js:2903:42)
    at Object.invoke (http://127.0.0.1:9000/bower_components/angular/angular.js:4862:19)
    at http://127.0.0.1:9000/bower_components/angular/angular.js:4656:37
    at getService (http://127.0.0.1:9000/bower_components/angular/angular.js:4803:32)
    at injectionArgs (http://127.0.0.1:9000/bower_components/angular/angular.js:4828:58)
    at Object.invoke (http://127.0.0.1:9000/bower_components/angular/angular.js:4854:18)
    at http://127.0.0.1:9000/bower_components/angular/angular.js:7965:43
    at forEach (http://127.0.0.1:9000/bower_components/angular/angular.js:357:20)
    at Object.<anonymous> (http://127.0.0.1:9000/bower_components/angular/angular.js:7963:13)
    at Object.invoke (http://127.0.0.1:9000/bower_components/angular/angular.js:4862:19) Possibly unhandled rejection: {}

@dashawk
Copy link

dashawk commented Mar 3, 2017

I just solved this problem by updating angular-animate to 1.6.2 as well

@andertun
Copy link

I have this issue with
Angular 1.6.4
ui-router 0.4.2

But only when using the minified version of ui-router (bower_components/angular-ui-router/release/angular-ui-router.min.js).

When I minify it myself the issue goes away.

@msudgh
Copy link

msudgh commented May 1, 2017

Still having this issue.

angular: 1.6.4
angular-animate: 1.6.4
angular-ui-router: 0.4.2

@amshekar
Copy link

amshekar commented May 1, 2017

I solved it by updating the html
from <a href="/#/profile">Profile</a> to <a href="/#!/profile">Profile</a>

i.e /#/ from /#!/

below are my angular ,animate and ui-router versions
angular: 1.6.4
angular-animate: 1.6.4
angular-ui-router: 0.4.2

@greatsayan
Copy link

Don't have the problem anymore.
angular: 1.6.4
angular-animate: 1.6.4
angular-ui-router: 0.4.2

@palmeranderan
Copy link

Had some troubles but FINALLY found the mistake, keep attention to the parenthesis:
Correct Way:
YourService.getData.then( function(res) { $scope.userWithQ = res.data; }, function(error) { //unused } );
My mistake was to close the ")" before the function error and visual Studio 2015 doesn't advice for a mistake.
MY Mistake:
YourService.getData.then( function(res) { $scope.userWithQ = res.data; }), function(error) { //unused };
Hope u find this helpful

@bernardolm
Copy link

OK with:
angular: 1.6.6
angular-ui-router: 0.4.2

@hugsbrugs
Copy link

I have the problem with
angular: 1.6.8
angular-animate: 1.6.8
angular-ui-router: 0.4.2
Fixed it by including non minified version of ui-router (being minified by my gulp process)

@soroushNeshat
Copy link

if u are using angularJs 1.6.0+ then u have to use Angular-ui-router 1.0.0+

@soroushNeshat
Copy link

soroushNeshat commented Jan 13, 2018

plus $stateChange is not working in angular-ui-router anymore , u must use transition hook instead . read more here : https://ui-router.github.io/guide/transitionhooks

@dashawk
Copy link

dashawk commented Jan 16, 2018

Here is an example that I used in my app:

$transitions.onBefore({ to: 'app.dashboard' }, function (transition) {
	if (!AUTHENTICATED) {
		return $state.target('app.login');
	}
}, { priority: 10 });

@soroushNeshat
Copy link

@dashawk better to change this line of your code return $state.target('app.login'); to
return transition.router.stateService.target('app.login');

@pawanannigeri
Copy link

Hi,

I have migrated my angular js from 1.5.9 to 1.6.9 and angular ui router to 1.0.15, resolve property inside multiple views is not working. Below is the code for the reference...

$stateProvider
.state('home', {
data: {
pageTitle: ''
},
url: '/',
views: {
'header': {
templateUrl: 'xview/common/header.jsp'
},
'header-band': {
templateUrl: 'xview/common/home-carousel.jsp',
controller: 'CarousalController',
controllerAs: 'carousal'
},
'message-container': {
templateUrl: 'xview/common/message-container.jsp',
controller: 'MessageContainerController',
controllerAs: 'messageContainer',
resolve: {
successMessages: ['RestService', function (RestService) {
var params = {
action: 'manage_user',
method: 'get_validationrules',
url: RESOURCE_CONTEXT_PATH+'/assets/resources/successcodes.json'
};

                  return RestService.getConfig(params, true);
                }], 
                appConfig: ['RestService', function (RestService) {
                  var params = {action: 'config_manage', method: 'config_home', data: {}};

                  return RestService.getData(params, true);
                }]
              }
            },
            'nav': {
              templateUrl: 'xview/navigation/home-nav.jsp',
              controller: 'LoginController',
              controllerAs: 'loginNav', 
              resolve: {
                validations: ['RestService', function (RestService) {
                  var params = {
                    action: 'manage_user', 
                    method: 'get_validationrules', 
                    url: RESOURCE_CONTEXT_PATH+'/assets/resources/validationrules.json'
                  };

                  return RestService.getConfig(params, true);
                }]
              }
            },
            '': {
              templateUrl: 'xview/common/home.jsp',
              controller: 'AssetsController',
              controllerAs: 'asset'
            },
            'footer': {
              templateUrl: 'xview/common/footer.jsp',
              controller: ['LocaleService', 'AssetsService', '$location', '$state',
                function (LocaleService, AssetsService, $location, $state) {
                  this.changeLanguage = function (locale) {
                    LocaleService.setLocaleByDisplayName(locale);
                    
                    /* 
                     * During language switch event, if the user is in help&support page
                     * we should refresh the same ng-view to switch help&support page based on the lang
                    */
                    if ($location.path() === '/nl-help') {
                      $state.go('home.nl-help', {}, {reload: true});
                    } else if ($location.path() === '/index-logged-in/help') {
                      $state.go('home.index-logged-in.help', {}, {reload: true});
                    }
                  };
                  if (AssetsService.getAppConfig()) {
                    this.portalVersion = AssetsService.getAppConfig().config.PORTAL_VERSION;
                    if (!this.portalVersion) {
                      this.portalVersion = '-';
                    }
                  }
                }],
              controllerAs: 'footer'
            }
          }
        }) 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests