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

cat-boot-enum error on first page load #14

Open
JoelColledge opened this issue Mar 25, 2016 · 3 comments
Open

cat-boot-enum error on first page load #14

JoelColledge opened this issue Mar 25, 2016 · 3 comments

Comments

@JoelColledge
Copy link
Contributor

The first time that I load an Angular page with a cb-enum select control, it is not populated and I see an error in the developer console. The error is not seen when I subsequently reload the page, perhaps due to caching.

This can be reproduced with https://github.com/Catalysts/cat-boot-sample (master), loading http://localhost:8080/angular#/dynamic-page-1. Adding a loading screen does not fix the issue (see branch feature/jc/loading-screen).

The error is shown below:

angular.js:13294Error: Not yet initialized!
    at CatBootEnumService.list (http://localhost:8080/webjars/cat-boot-i18n-angular/0.0.10/cat-boot-enum/cat-boot-enum-service.js:35:23)
    at link (http://localhost:8080/webjars/cat-boot-i18n-angular/0.0.10/cat-boot-enum/cat-boot-enum-directive.js:28:48)
    at ma (http://localhost:8080/webjars/angular/1.5.2/angular.min.js:79:117)
    at n (http://localhost:8080/webjars/angular/1.5.2/angular.min.js:64:405)
    at g (http://localhost:8080/webjars/angular/1.5.2/angular.min.js:57:378)
    at n (http://localhost:8080/webjars/angular/1.5.2/angular.min.js:64:349)
    at g (http://localhost:8080/webjars/angular/1.5.2/angular.min.js:57:378)
    at g (http://localhost:8080/webjars/angular/1.5.2/angular.min.js:57:395)
    at http://localhost:8080/webjars/angular/1.5.2/angular.min.js:57:17
    at A.link (http://localhost:8080/webjars/angular-route/1.5.0/angular-route.min.js:7:442) 
@JoelColledge
Copy link
Contributor Author

#13 suggested a possible fix. Another possible fix I've seen online involved adding special logic in the route provider config (app.js in cat-boot-sample), but I have not investigated that further.

@tsalzinger
Copy link
Contributor

your application has to wait until the promise is returned, this can be achieved via the 'resolve' properties of ngRoute or uiRouter

if you don't use any router you would have to add some custom handling for this case

@JoelColledge
Copy link
Contributor Author

From the code, it looks like loadingPromise is intended as an implementation detail and not as part of the API. How should we access it?

In addition, I don't like the idea that the router has to know about the dependencies of the individual pages. Maybe that could be solved by somehow getting the 'resolve' value from the controller?

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

2 participants