user1354934 user1354934 - 3 months ago 92
AngularJS Question

Making a multi step form with 4 steps. If I come back from step 3 to 2, how do I show the data saved from step 2?

For example,

say the user is on step 2, and enters his name in

<input type="text" class="form-control input-xl" ngModel name="firstName">


He goes to step 3, but now wants to come back to step 2. I have the data saved in my form object,
formData.stepTwo.firstName
. How do I show this in the input instead of blank?

I am using angular 2. Thanks

Answer

Try this:

<input type="text" class="form-control input-xl" [(ngModel)]="formData.stepTwo.firstName" name="firstName">