[AngularJS] Re: ERROR in compiler_1.StaticSymbolCache is not a constructor
So I possibly fixed it. I created a new project and used the package.json file values in the existing project's json file. Then I removed node_modules and dist folders, rerun npm install --save-dev @angular/cli@latest and npm install and now ng serve works. > -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] ERROR in compiler_1.StaticSymbolCache is not a constructor
ng --version @angular/cli: 1.0.0-beta.32.3 [1.0.0-beta.31] node: 6.9.5 os: win32 x64 @angular/common: 2.2.1 @angular/compiler: 2.2.1 @angular/core: 2.4.7 @angular/forms: 2.2.1 @angular/http: 2.2.1 @angular/platform-browser: 2.2.1 @angular/platform-browser-dynamic: 2.2.1 @angular/router: 3.2.1 @angular/cli: 1.0.0-beta.32.3 @angular/compiler-cli: 2.4.7 >ng serve ** NG Live Development Server is running on http://localhost:4200. ** Hash: e0d3674f7d03f30ffc2f Time: 13016ms chunk{0} main.bundle.js, main.bundle.js.map (main) 51.1 kB {2} [initial] [rendered] chunk{1} styles.bundle.js, styles.bundle.js.map (styles) 11.7 kB {3} [initial] [rendered] chunk{2} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.67 MB [initial] [rendered] chunk{3} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered] ERROR in compiler_1.StaticSymbolCache is not a constructor webpack: Failed to compile. This problem started after I had to upgrade node from 4.5 to 6.9.5. And then upgraded angular-cli from beta 16 to beta 31. It has been raised at https://github.com/angular/angular-cli/issues/4464 but not currently assigned and nothing happening. Is anyone else having this problem? -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] ng serve -prod shows error
Hi, I wanted to use the environment.ts and environment.prod.ts files to set some variables. I added a console.log to the service code to see if they were being set. When I run ng serve, the code compiles and the browser console shows my comment and the value is as expected; so far so good. But when I run ng serve -prod to see if the comment changes with the new value, I get the following warning (?) and error This is a simple server for use in testing or debugging Angular applications locally. It hasn't been reviewed for security issues. DON'T USE IT FOR PRODUCTION USE! ** NG Live Development Server is running on http://localhost:4200. ** (This is a comment/warning?) followed by ERROR in C:/Temp/angularjs_example/angular2/heroes_new/src/environments/environment.ts (2,19): ',' expected.) C:/Temp/angularjs_example/angular2/heroes_new/src/environments/environment.ts (6,36): ',' expected.) webpack: Failed to compile. Now the thing I do not understand is that environment.ts (2,19): is a comment // The build system defaults to the dev environment which uses `environment.ts`, but if you do and actually adding a comma to the above comment then allows compile to succeed. Can someone explain this? -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: deploying an angular 2 app
So the "standard" way would be a data backend providing REST running in one application and the angular 2 app being packaged up and run as another application? > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: angular 2 heroes tutorial - using a server for data
> > Hi Sander, > I do not think it is a CORS issue because I did have CORS errors in the browser debugger console. These stopped when I added a grails plugin for the data server. Because of the log messages from Tomcat, I do think that is doing its job so the problem is somewhere inside the angular call and handling the return data. Of course having said that, it could well be that the structure of the JSON data returned by the server is the wrong structure for Angular. If I was to reset the angular app to use in memory web api, is there a way of showing the JSON that is returned so that I could compare it with the data that curl receives from the server? Using Edge browser, this is the debug info (I have removed repeated info SCRIPT7002: XMLHttpRequest: Network Error 0x2efd, Could not complete the operation due to error 2efd. An error occurred Response with status: 0 for URL: null main.bundle.js (22561,9) "An error occurred" { [functions]: , __proto__: { }, _body: { }, headers: { }, ok: false, status: 0, statusText: "", type: 3, url: null } EXCEPTION: Uncaught (in promise): Response with status: 0 for URL: null ORIGINAL STACKTRACE: main.bundle.js (41416,13) Error: Uncaught (in promise): Response with status: 0 for URL: null at resolvePromise (http://localhost:4200/main.bundle.js:72994:25) at resolvePromise (http://localhost:4200/main.bundle.js:72979:17) at Anonymous function (http://localhost:4200/main.bundle.js:73027:17) at ZoneDelegate.prototype.invokeTask (http://localhost:4200/main.bundle.js:72799:17) at onInvokeTask (http://localhost:4200/main.bundle.js:59333:21) at ZoneDelegate.prototype.invokeTask (http://localhost:4200/main.bundle.js:72799:17) at Zone.prototype.runTask (http://localhost:4200/main.bundle.js:72701:21) at drainMicroTaskQueue (http://localhost:4200/main.bundle.js:72933:25) at invoke (http://localhost:4200/main.bundle.js:72873:25) main.bundle.js (41417,13) Unhandled Promise rejection: Response with status: 0 for URL: null ; Zone: angular ; Task: Promise.then ; Value: Response with status: 0 for URL: null undefined Error: Uncaught (in promise): Response with status: 0 for URL: null Is there anything here which is helpful? John -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: angular 2 heroes tutorial - using a server for data
Hi Sander, I do not think it is a CORS issue because I did have CORS errors in the browser debugger console. These stopped when I added a grails plugin for the data server. Because of the log messages from Tomcat, I do think that is doing its job so the problem is somewhere inside the angular call and handling the return data. Of course having said that, it could well be that the structure of the JSON data returned by the server is the wrong structure for Angular. If I was to reset the angular app to use in memory web api, is there a way of showing the JSON that is returned so that I could compare it with the data that curl receives from the server? Interestingly, if I use MS Edge browser, then the get call in the angular code is not reaching tomcat. If I use Firefox it is reaching tomcat. Using F12 debug console, I get Exception: Uncaught (in promise): TypeError: heroes is undefined So though data is returned from server it is not being handled by the promise callback. I think. Regards, John -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: angular 2 heroes tutorial - using a server for data
Just to add, how can the URL be null when the there is a record in the tomcat log showing a 200 response to a request? > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: angular 2 heroes tutorial - using a server for data
Hi Sander, yes that did help, getting rid of the data part.. I think there was a problem with a change in angular so I upgraded. Unfortunately ng init is not working in the new version so was unable to upgrade the application but I recreated it from scratch and switching between in memory db and the grails server now works. There is a problem with the grails server now in terms of retrieving new data but that is a different problem. Many thanks, John > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] deploying an angular 2 app
Hi, new to angular. I was wondering how to deploy an angular app to a web server? Is there documentation on this. I have experience with Java and Tomcat applications but not sure how it works where all of the logic is in the front end. Regards, John -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] angular 2 tutorial - http
Hi, going through the tutorial. If I wanted to use a real web server to supply data (rather than the InMemoryDataService), would all I have to do is change the heroesURL value to something like fred dot com? Regards, John -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] angular 2 heroes tutorial - using a server for data
Hi, Using the Heroes tutorial on the Angular 2 website. I have set up the heroService to use a rest service from tomcat. Using curl produces the correct result C:\Temp\curl>curl http://centos7-ansible:8080/heroes/heroes [{"id":1,"name":"Mr. Nice"},{"id":2,"name":"Narco"},{"id":3,"name":"Bombasto"},{"id":4,"name":"Celeritas"},{"id":5,"name":"Magneta"},{"id":6,"name":"RubberMan"},{"id":7,"name":"Dynama"},{"id":8,"name":"Dr IQ"},{"id":9,"name":"Magma"},{"id":10,"name":"Tornado"}] So in the hero.service.ts, private heroesUrl = 'http://centos7-ansible:8080/heroes/heroes'; // URL to web api getHeroes(): Promise{ return this.http.get(this.heroesUrl) .toPromise() .then(response => response.json().data as Hero[]) .catch(this.handleError); } In the calling component, ngOnInit(): void { console.log("about to get data"); this.heroService.getHeroes().then(heroes => this.heroes = heroes.slice(4, 8)); console.log("returned from getting data"); console.log(length of array is " + this.heroes.length ); } Looking at the console I get about to get data GET http://centos7-ansible:8080/heroes/heroes 200 OK 43ms returned from getting data length of array is 0 So it works from curl but within Angular does not. Also, looking at the access log in Tomcat, the same log message is for both curl and angular access. "GET /heroes/heroes HTTP/1.1" 200 273 "GET /heroes/heroes HTTP/1.1" 200 273 Is the "273" the length of data returned? Which would suggest the data is there but is not being put in the Hero array? Is my heroesUrl correct? Within console, I get EXCEPTION: Uncaught (in promise): TypeError: e is undefined What does this mean? What is "e"? How do I go about debugging this as the console gives the code lines as part of a bundle.js. Regards, John -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: angular 2 heroes tutorial - using a server for data
I added the following console messages getHeroes(): Promise{ return this.http.get(this.heroesUrl) .toPromise() .then(response => { console.log("service response text " + response.statusText); console.log("service response data " + response.json().data); console.log("service response status " + response.status); response.json().data as Hero[];} .catch(this.handleError); } and the output was service response text OK service response dataundefined service response status 200 returned heroes is undefined > > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: Heroes tutorial - added hero not displayed
Hi Sander, the service code is create(name: string): Promise { return this.http .post(this.heroesUrl, JSON.stringify({name: name}), {headers: this. headers}) .toPromise() .then(res => res.json().data) .catch(this.handleError); } and you were right - it is the service code. I returned res.json().data when I should return res.json() and that now updates the code. Many thanks for the help. John > -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Heroes tutorial - added hero not displayed
Hi, I have used the heroes tutorial and when using in memory this works. But if I get the data from an external source eg grails 3 rest api then adding a hero behaves differently. The hero is added to the database (I can see that via curl) but the listing of heroes has a place holder for the new hero but no text (no id, no name). A manual refresh of the browser shows a completed list with the new hero properly displayed. The browser console shows POST http://centos64:8080/heroes 201 EXCEPTION: Error in ./HeroesComponent class HeroesComponent - inline template:11:23 caused by: self.context.$implicit is undefined ORIGINAL EXCEPTION: self.context.$implicit is undefined This is the code for the component add(name: string): void { name = name.trim(); if (!name) { return; } this.heroService.create(name) .then(hero => { this.heroes.push(hero); this.selectedHero = null; }); } This is the code for the template {{hero.id}} {{hero.name}} x The service is working - it updates the database so I assume that is OK. Does anyone have any ideas? Regards, -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] heroes tutorial - console log
Hi, I have been amending the heroes tutorial and come across something that I do not understand so hopefully some one can help. In HeroesComponent.ts is this snippet of code export class HeroesComponent implements OnInit { heroes: Hero[]; selectedHero: Hero; constructor(private router: Router, private heroService: HeroService) { } getHeroes(): void { this.heroService.getHeroes().then(heroes => this.heroes = heroes); } ngOnInit(): void { this.getHeroes(); } onSelect(hero: Hero): void { this.selectedHero = hero; } And this works - the hero names are displayed to the corresponding html. But, in getHeroes(), if I add a console statement getHeroes(): void { this.heroService.getHeroes().then(heroes => this.heroes = heroes); console.log("heroes list is " + this.heroes) } Then the browser console shows "heroes list is undefined", yet the array of hero is displayed in the html. Why is heroes undefined? -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] relationships between domains - documentation?
Hi, I have two domain types with a link between them. My data backend is Grails and I have set this up and tested it using curl. But I can't find any documentation on how to reflect this in the angular 2 client. Could someone point me in the direction of this? Regards, John -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: Permission denied to access property "rejection"
I think this may have something to do with using console.log in the wrong place. But really not sure. > -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Permission denied to access property "rejection"
Hi, I started with the heroes tutorial and have changed the "add hero" code to a form. I do realise that from a controller perspective it would be far better to have this as a separate component and html. And that is fine. But when I run the current page (form plus a loop of ngFor), the form is displayed but the list of heroes is not. In the browser console I can see the get works and returns the correct records in JSON but then I get Permission denied to access property "rejection" Having googled it seems I am accessing something that I do not have permission for such as in a different domain. The set up is that the data access is via a grails app and running angular via ng-serve. The only place (?!?) I could have permission problems is with the data access and that is working. So even though the current approach is not the best approach, I would like to know what is causing the error. Does anyone have any ideas? Regards, John -- You received this message because you are subscribed to the Google Groups "Angular" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: ng new -4048 error
> > Just to add, if I create a new project, I get exactly the same problem. > Interestingly the command tries to rename files it has already created in > the new projects node_modules folder eg > npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\rxjs-67f86bc0' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\rxjs' npm ERR! at destStatted (C:\Users\jnorris\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7) npm ERR! at FSReqWrap.oncomplete (fs.js:123:15) So it is moving a temp rxjs folder from .staging to node_modules. And either does not have permission to delete or write. I have upgraded angular2 before and had troubles then with existing projects but could create new projects. Now it will not even create new projects. And this is windows so permissions do not really come into it. -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
Looking through the grails log, I see the following. The request from the browser is being picked up 24 Mar 2017;09:50:40.737 DEBUG org.apache.coyote.http11.Http11InputBuffer - Received [GET /heroes?max=15 HTTP/1.1^M Host: centos64:8080^M User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0^M Accept: application/json, text/plain, */*^M Accept-Language: en-GB,en;q=0.5^M Accept-Encoding: gzip, deflate^M Referer: http://localhost:4200/dashboard^M Origin: http://localhost:4200^M DNT: 1^M Connection: keep-alive^M And then it finds the data 24 Mar 2017;09:50:42.299 DEBUG org.hibernate.engine.internal.Collections - Collection found: [heroes2.Publisher.heroes#1], was: [heroes2.Publisher.heroes#1] (initialized) 24 Mar 2017;09:50:42.299 DEBUG org.hibernate.event.internal.AbstractFlushingEventListener - Flushed: 0 insertions, 0 updates, 0 deletions to 12 objects 24 Mar 2017;09:50:42.300 DEBUG org.hibernate.event.internal.AbstractFlushingEventListener - Flushed: 0 (re)creations, 0 updates, 0 removals to 1 collections 24 Mar 2017;09:50:42.300 DEBUG org.hibernate.internal.util.EntityPrinter - Listing entities: 24 Mar 2017;09:50:42.300 DEBUG org.hibernate.internal.util.EntityPrinter - heroes2.Hero{flight=false, invulnerable=false, strength=false, city=null, name=Iron Man, publisher=null, id=11, version=0} etc etc But then I get an error 24 Mar 2017;09:50:42.305 DEBUG org.grails.web.servlet.mvc.GrailsWebRequestFilter - Cleared Grails thread-bound request context: org.apache.catalina.connector.RequestFacade@1ae7a41a 24 Mar 2017;09:50:42.381 DEBUG org.apache.coyote.http11.Http11Processor - Error parsing HTTP request header java.io.EOFException: null at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.fillReadBuffer(NioEndpoint.java:1222) at org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper.read(NioEndpoint.java:1163) at org.apache.coyote.http11.Http11InputBuffer.fill(Http11InputBuffer.java:742) at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:404) at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:994) at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:785) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1425) at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 24 Mar 2017;09:50:42.382 DEBUG org.apache.coyote.http11.Http11Processor - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@564d6ef5:org.apache.tomcat.util.net.NioChannel@49642f0f:java.nio.channels.SocketChannel[connected local=/192.168.1.81:8080 remote=/192.168.1.71:50944]], Status in: [OPEN_READ], State out: [CLOSED] 24 Mar 2017;09:50:42.382 DEBUG org.apache.tomcat.util.threads.LimitLatch - Counting down[http-nio-8080-exec-2] latch=1 And I am not sure what causes that. -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
Just to add, I have found this http://tomcat.10.x6.nabble.com/How-to-write-a-correct-HTTP-request-to-Tomcat-8-5-4-instance-td5054729.html in summary, it wonders if the correct end of line is being sent. I was running beta16 of angular2 and then upgraded to beta32 and now 1.rc4. And these problems started around the time of leaving beta16. Is there something I was supposed to change for the later versions? I really do not think the problem is at the grails end but it is obvious I do need help on this. -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
>From the error on the grails side (the API side), it appears to think the request header is incorrect. So is it possible that Angular is not sending the correct header? But I am confused that Grails accepts the request, does everything it should do like get data and then decides the request header is wrong. -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
Hi Zachary, but if authentication has been left in the server, would curl have worked? >> -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] unable to read rest server with angular 2
Hi, I have a grails rest api server. This returns data when I use curl. I have used the angular 2 heroes application to display this data. This was working and then I added authentication and it stopped working. I have returned to the pre authentication set up and I still get the same errors. I have logging on grails and I can see that it returns the data. But the data is not displayed within the browser. I have switched on the browser debugging console. Network does not show any errors but the console shows quite a few. I must admit I do not really understand what is going wrong from this so hopefully someone can point me in the right direction. "url is http://centos64:8080/heroes?max=15; An error occurred Object { _body: error, status: 0, ok: false, statusText: "", headers: Object, type: 3, url: null } EXCEPTION: Uncaught (in promise): Response with status: 0 for URL: null ORIGINAL STACKTRACE: vendor.bundle.js:59773:13 resolvePromise@http://localhost:4200/vendor.bundle.js:98058:31 resolvePromise@http://localhost:4200/vendor.bundle.js:98043:17 scheduleResolveOrReject/<@http://localhost:4200/vendor.bundle.js:98092:17 ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97855:21 NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@http://localhost:4200/vendor.bundle.js:31513:28 ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97854:21 Zone.prototype.runTask@http://localhost:4200/vendor.bundle.js:97744:28 drainMicroTaskQueue@http://localhost:4200/vendor.bundle.js:97991:25 ZoneTask/this.invoke@http://localhost:4200/vendor.bundle.js:97929:25 vendor.bundle.js:59774:13 Unhandled Promise rejection: Object { _body: error, status: 0, ok: false, statusText: "", headers: Object, type: 3, url: null } ; Zone: angular ; Task: Promise.then ; Value: Object { _body: error, status: 0, ok: false, statusText: "", headers: Object, type: 3, url: null } undefined vendor.bundle.js:97978:13 Error: Uncaught (in promise): Response with status: 0 for URL: null Stack trace: resolvePromise@http://localhost:4200/vendor.bundle.js:98058:31 resolvePromise@http://localhost:4200/vendor.bundle.js:98043:17 scheduleResolveOrReject/<@http://localhost:4200/vendor.bundle.js:98092:17 ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97855:21 NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@http://localhost:4200/vendor.bundle.js:31513:28 ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97854:21 Zone.prototype.runTask@http://localhost:4200/vendor.bundle.js:97744:28 drainMicroTaskQueue@http://localhost:4200/vendor.bundle.js:97991:25 ZoneTask/this.invoke@http://localhost:4200/vendor.bundle.js:97929:25 Here is the code in the service module. Note that the second log message does not show. getHeroes(): Promise{ const url = `${this.heroesUrl}?max=15`; console.log("url is " + url) return this.http.get(url) .toPromise() .then(response => { console.log("response is " + response.json()); response.json() as Hero[] } ) .catch(this.handleError); } Regards, John -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
Hi Kyle, the curl command is C:\Temp\curl>curl http://centos64:8080/heroes [{"id":1,"city":"Metropolis","flight":true,"invulnerable":false,"name":"Mr. Nice","strength":false},{"id":2,"city":"Reading","flight":false,"invulnerable":false,"na etc etc etc And this is the original code from the heroes tutorial getHeroes(): Promise{ return this.http.get(this.heroesUrl) .toPromise() .then(response => response.json().data as Hero[]) .catch(this.handleError); } As you can see I really did not change this. Regards, John -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
Hi Sander, I am not convinced that it is a CORS issue for a few reasons. I did have CORS issues to begin with and the message in the browser console always mentioned "CORS". Also Grails 3.x.x (I forget the exact version) has built in CORS. And looking at the grails logs, it is quite happily getting the data and returning it. So the problem appears to be between grails sending the data and angular receiving it. The frustration is that this is was working but then stopped with authentication (getting the errors above) and now going back to the original (no authentication), the errors have followed it. Again, the errors are not really giving me anything to work with eg An error occurred Object { _body: error, status: 0, ok: false, statusText: "", headers: Object, type: 3, url: null } regards, John > -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: unable to read rest server with angular 2
Well Sander and Kyle, any ideas? I suspect this is something unique to me (ie have I done something dumb) but the problem I have is how to debug this. I can debug on the server side and see that data is being found (and in the past, if it is cors, then the data is not retrieved by the server, the request is rejected) but how do I debug on the angular side? It looks as though the promise is not returning (for instance is the request timing out to quickly?) but it is how to debug this. By the way, I have been testing this in Firefox. I get the sane result in Edge. I have just realised that I should have told you that the handleError routine is being called. private handleError(error: any): Promise { console.error('An error occurred', error); return Promise.reject(error.message || error); } but the value of error, when opened and drilled down does not have anything that leaps out. -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] ng new -4048 error
Hi, not sure what event has caused this but in the last few days my angular 2 installation on windows has gone badly wrong. As an example running ng new proj-name gives the following (only last lines shown) (node:7180) Warning: Possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.1 npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jnorris\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! node v6.9.5 npm ERR! npm v3.10.7 npm ERR! path C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8 npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall rename npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core' npm ERR! at destStatted (C:\Users\jnorris\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7) npm ERR! at FSReqWrap.oncomplete (fs.js:123:15) npm ERR! npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core' npm ERR! at Error (native) npm ERR! { Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core' npm ERR! at destStatted (C:\Users\jnorris\AppData\Roaming\npm\node_modules\npm\lib\install\action\finalize.js:25:7) npm ERR! at FSReqWrap.oncomplete (fs.js:123:15) npm ERR! npm ERR! Error: EPERM: operation not permitted, rename 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\@angular\core-e9954ff8' -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\@angular\core' npm ERR! at Error (native) parent: 'heroes2' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! Please include the following file with any support request: npm ERR! C:\Temp\angularjs_example\angular2\heroes2\npm-debug.log Package install failed, see above. Running in an administrator window makes no difference. I did see something that said I needed to change permissions at C:\Users\jnorris\AppData\Roaming\npm. This folder was read only and I changed that. But still same problem. ng --version @angular/cli: 1.0.0-beta.32.3 node: 6.9.5 os: win32 x64 Does anyone know what has caused this and what can fix it? Regards, John -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: ng new -4048 error
> > Hi Sander, > followed the instructions - uninstalled global, installed global latest, installed in existing project having removed node_modules and exactly the same result. At end of npm install --save-dev @angular/cli@latest, I got the same EPERM -4048 error. Same result if I run in administrator console. I seem to have some serious corruption here - any other ideas? -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] users appdata/roaming/npm folder - safe to delete?
Hi, I am unable to create a new project (ng new). It fails with permissions problems on the above folder. I have reinstalled / upgraded via the instructions in the wiki but same problem. Is it safe to delete this folder? Regards, John -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: ng new -4048 error
> > EPERM: operation not permitted, rename > 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\.staging\rxjs-67f86bc0' > > -> 'C:\Temp\angularjs_example\angular2\heroes2\node_modules\rxjs' > So I did this manually in file explorer - moved the rxjs-67f86bc0 folder into node_modules. And it failed saying that a file in this folder was already opened by another process. Then tried it a few minutes later and it worked. So something has files in .staging open and that is preventing move / rename. Does anyone have any ideas what this might me? -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: ng new -4048 error
And now it works . > > >> -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
[AngularJS] Re: users appdata/roaming/npm folder - safe to delete?
> > Thanks Sander. I actually I did try it earlier and reinstalled but still > same problem. I will update the original topic on this problem because > there is something you may know about. > John -- You received this message because you are subscribed to the Google Groups "Angular and AngularJS discussion" group. To unsubscribe from this group and stop receiving emails from it, send an email to angular+unsubscr...@googlegroups.com. To post to this group, send email to angular@googlegroups.com. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.