Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AngularJS An Introduction to Two-Way Data Binding What is two-way data binding?

How come I am not able to make this code work with sublime?

It's not responsive in chrome.

5 Answers

adam åslund
PLUS
adam åslund
Courses Plus Student 12,184 Points

Hi Paul!

The reason why it doesn't work is because AJAX only works on a webserver. This is a picture that shows the differences between review the files and the files running on a localhost.

There is two easy ways to inspect the webapp you are making. When you use your favorite text editor.

  1. You download the project and write the code locally. When you are ready to test it you just copy the new code in to work spaces here at treehouse. You only need to copy paste. Then preview.

  2. Get a localhost running on your own computer. I do this whit live reload on the page. So each time I save a file, the browser reloads the page. Right now I'm running a simple LAMP stack on my Linux machine. MAMP on mac and WAMP on windows works as well. There's even courses on how to install it on your mac and windows machine here on treehouse.

I hope this helps even tho it's been 19days since you asked the question.

What issue are you having ? And are you trying to run your JavaScript code in Sublime?

Anselmo Fresquez
PLUS
Anselmo Fresquez
Courses Plus Student 8,086 Points

You would need to be running a local web server. Xampp or Mamp are easy to setup.

For a quick fix on a local host, you can use CDN instead of downloading Angular and JQuery into your project.

replace:

 <script type="text/javascript" src="//code.jquery.com/jquery-1.11.0.min.js"></script>
    <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js"></script>

with:

<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.

Cheers!

jason chan
jason chan
31,009 Points

you have to run a server to make it work. For example run on apache.

Install python 3.0

Navigate to folder of script with commandline using cd. I hope that helps. command python -m http.server in terminal this is pc. python -m SimpleHTTPServer for mac