Have trouble in Local storage/save() function.. Help!


Hello, I am a high school student looking to make a web app using Ember. I plan on making a community directory where you can search for students, click on a student, and then go back to your search.

I have just finished the Ember tutorial for beginners. When I arrived at the “Marking a Model as Complete or Incomplete” section, it asked me to include a line “model.save()”. After I copied my HTML file directly from the HTML in the Live bin, and the same for the JS (I made all the JS files just as they said rather than putting it into one big JS file) except I split up all of the JS by which file it goes into. When I ran my application, it loaded without error and the first todo was green, or completed. However, when I clicked on it to change it from complete to incomplete, nothing happened. The screen did not change, and this exact line was printed to the console:

Uncaught TypeError: undefined is not a function

After several frustrating moments, I commented one line in the JS so that it read" //model.save(); "I reloaded the page, and then it worked fine! The console had no errors to print when I clicked on the check and the todo was toggled between complete and incomplete.

From there after, all the steps that included the line “.save()” in the JS file caused me to get the same error whenever I did what that step was supposed to allow me to do (such as editing a todo)

Uncaught TypeError: undefined is not a function

BUT, when I commented the “.save()” line out in all of those files, the web app did exactly what it was supposed to and did all the same functions as the Live Bin in the tutorial.

So, whenever I came across a line with “.save()”, I commented it out and all was well until I got to the last step, which is Replacing the Fixture Adapter with Another Adaper. In this step, the goal was to replace our fixture data with real persistence so todos will remain between application loads by replacing the fixture adapter with a localstorage-aware adapter instead. This works on Ember’s website: when I close my Ember tab and then go back to the tutorial, it has the changes I made to the todos list. On my website, this does not happen. When I go back and un-comment all the commented lines with “.save()”, the local storage still doesn’t work AND I have the same problems as before, I cannot toggle completion of todos, edit todos, etc.

I have meticulously copied the HTML and JS files from the Live BIn on Ember’s website into my own files, why isn’t this step working? And why do I have to comment out the “.save()” line in order for some of my JS to work? I am using Google Chrome, if that makes a difference.