0

I downloaded the projects in this link (http://angular-tips.com/blog/2015/01/a-backend-less-plunker/)

When I click index.html, it cannot execute. I need to use web server to host it? If not, how can I run this index.html

  • 1
    Welcome to Stack Overflow. Please provide more details about your issue. What "cannot execute" means and what happens when you try accessing the index.html file? Have you checked the browser's console (usually F12) for errors? – Boaz Dec 04 '16 at 01:48
  • "cannot execute" means not display what is supposed to be. I mean it should display something in the page. I know it should use something to host it. But I just do not know which one is good to host it. –  Dec 04 '16 at 01:53
  • No hosting is needed. It should work in the browser as-is. You might be missing a file or there may be some other issue. You will need to check in the browser's error console to find out more details. – Boaz Dec 04 '16 at 01:55
  • I got three error: 1. angular.js:9812 XMLHttpRequest cannot load 2. angular.js:11592 Error: [$compile:tpload] Failed to load template: todos.html 3. Failed to load resource: net::ERR_FILE_NOT_FOUND –  Dec 04 '16 at 01:59
  • But I download the Brackets as Jerry mentioned, I just load the project folder, it just works. I do not know why it can work when I use Brackets this software. Do you have idea about it –  Dec 04 '16 at 02:01
  • There's a limitation to how Chrome interprets the request for the "todos.html" file, effectively blocking it for "security" reasons. Brackets.io has a built-in server and so is able to circumvent this issue. **But this does not mean that Angular requires a server to run**. The easiest way around this problem in this case, is to include the template directly in the script. For example, [This plunker would work directly in the browser](https://plnkr.co/edit/v4c59I0v1gdd5UCz9uS1?p=preview). Actual development would require a server, like [XAMPP](https://www.apachefriends.org) or Node. – Boaz Dec 04 '16 at 02:30
  • Also, to work without a server, you may consider removing this limitation from Chrome: http://stackoverflow.com/questions/18586921/how-to-launch-html-using-chrome-at-allow-file-access-from-files-mode – Boaz Dec 04 '16 at 02:33
  • Thanks. When you directly add 'todos.html' into template, how do you add slash at the end of each line. Like '
    \
    –  Dec 04 '16 at 03:10
  • Can I put this project folder in ASP.NET MVC project in Visual Studio to make it run? –  Dec 04 '16 at 03:13

1 Answers1

0

Try downloading brackets.io. Load the files into brackets.io UI and run the code. This will execute the code for you.

Jerry
  • 6,357
  • 8
  • 35
  • 50
  • This does not seem to answer the OP's question. This should probably be a comment. – Boaz Dec 04 '16 at 01:46
  • Hi Jerry, I download the Brackets as you mentioned, I just load the project folder, it just works. I do not know why it can work when I use Brackets this software but it cannot work when I just open index.html without using Brackets. Do you have idea about it –  Dec 04 '16 at 02:02