You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.
I noticed some strange behaviour when accessing the Angular App via ng serve.
Please note: all of this can easily be reproduced by checking out angular/chapter-8 and running ng serve --proxy-config ./proxy.mock.conf.json or ng test
When accessing the application at http://localhost:4200, the application cannot initialize correctly and throws two (!) "ERROR Error: "Uncaught (in promise): Object: {"response":{}}"".
I tried to dig into this error, but couldn't find the reason. I highly suspect it has something to do with the initialization of ModelManager. I tried many ways of delaying the initialization until the URL of the browser got updated, but couldn't get it working.
Since in production we anyways would call a "complete" URL, this would work there, but I am having a really hard time writing tests as the tests would access http://localhost:9876 and no "complete" URL.
I am mainly using the mock-json-approach which is working fine for development purposes. Any ideas whether this approach could also work in combination with ng test and a proxy config in karma.conf?
P.S.: Tests in this tutorial are failing as well - any chance we could get a chapter on testing?
The text was updated successfully, but these errors were encountered:
mzellho
changed the title
[Angular] Unexpected when directly accessing application
[Angular] Unexpected behaviour when directly accessing application
May 13, 2019
I noticed some strange behaviour when accessing the Angular App via
ng serve
.Please note: all of this can easily be reproduced by checking out
angular/chapter-8
and runningng serve --proxy-config ./proxy.mock.conf.json
orng test
When accessing the application at http://localhost:4200, the application cannot initialize correctly and throws two (!) "ERROR Error: "Uncaught (in promise): Object: {"response":{}}"".
Since the URL in the browser got updated to http://localhost:4200/content/wknd-events/angular/home.html, F5'ing will correctly load the application. Resetting the URL to http://localhost:4200 unsurprisingly leads to the same error.
I tried to dig into this error, but couldn't find the reason. I highly suspect it has something to do with the initialization of ModelManager. I tried many ways of delaying the initialization until the URL of the browser got updated, but couldn't get it working.
Since in production we anyways would call a "complete" URL, this would work there, but I am having a really hard time writing tests as the tests would access http://localhost:9876 and no "complete" URL.
I am mainly using the mock-json-approach which is working fine for development purposes. Any ideas whether this approach could also work in combination with
ng test
and a proxy config inkarma.conf
?P.S.: Tests in this tutorial are failing as well - any chance we could get a chapter on testing?
The text was updated successfully, but these errors were encountered: