Farata / angular2typescript

Code samples from the book Angular 2 Development with TypeScript
MIT License
440 stars 270 forks source link

Unable to launch Ch 2 solution #31

Closed aaonline closed 6 years ago

aaonline commented 6 years ago

Using Google Chrome I get following error

Failed to load file://Web/AngularWithTypescript/Chp1/main.ts: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https.

Please suggest.

yfain commented 6 years ago

Which app from CH2 gives you this error? How do you run this app? Which versions of node.js do you have installed? Have you tried running solutions from the A4 folder - they are for Angular 4 and Angular CLI?

aaonline commented 6 years ago

This code https://github.com/Farata/angular2typescript/tree/master/chapter2/hello-world-ts gave error.

I did not use node.js, etc as this is first angular example. So I just wrote the html and ts file and launched them in Google Chrome. I hope I am doing right here.

aaonline commented 6 years ago

This is fixed,

I started running http-server -o pointing it to the chapter2/hello-world-ts source code directory locally and it worked. So perhaps, this does not work without Node.js.

yfain commented 6 years ago

This has nothing to do with node.js. You should run this example using any web server. For example, you can go into the hello-world-ts directory and just run http-server from there.