BT101
BT101

Reputation: 3836

ng-repeat in label and input value

I have very large form field and in last step I would like to create a summary so people can see what they wrote there. It wouldn't be a problem to do this only with values which users passed to inputs but I also want to show labels of inputs before value.

So when HTML in form is:

<label for="one">First one:</label>
<input id="one" type="text" ng-model="firstInput">

I want to have something like:

First one: firstInput.value

where firstInput.value is just text which user wrote in input.

I've created basic schema for this: plunker

I do not have even idea how to accomplish that so I ask you for help.

EDIT

Actually as CanFil mentioned I can use (key, value) inside ng-repeat but it will display the ng-model name which in my case sometimes is meaningless for user that's why I prefer labels.

Upvotes: 1

Views: 971

Answers (1)

CanFil
CanFil

Reputation: 325

You can repeat json as key-value pair like;

(key, value) in inputs

your inputs json should be empty and you should bind your html inputs like;

inputs.firstinput

and of course use {{value}} for showing the value

Edited Plunker

Upvotes: 1

Related Questions