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 About Lists?

Anyone else had issues with the 'edit' portion?

Has anyone else had this issue? -when I follow along and add the 'edit' button, the app doesn't seem to prepopulate the form with the person's info, nor allow me to edit. I can't seem to catch anything I've done differently, maybe a script revision since this video was made?

The "edit" button works fine for me. As long as $scope.edit sets editingPerson to a person object and each input is binded to a property on editingPerson then the problem must be elsewhere.

1 Answer

John Keith Zank
John Keith Zank
11,848 Points

I initially had an issue with this too but I noticed around the 2:37 mark on the video he pastes in a form that initially isn't in the index.html form. It's pretty easy to miss but that form is what enables you the edit function to work in it's entirety. Here's the form he pasted in, hope that helped!

<form class="fields">
        <label>
          Name:
          <input type="text" ng-model="editingPerson.name" />
        </label>
        <label>
          Profession:
          <input type="text" ng-model="editingPerson.profession" />
        </label>
        <label>
          Hometown:
          <input type="text" ng-model="editingPerson.hometown" />
        </label>
</form>