Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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>