0

I have this form multiple times on the same page in angular2 to send the message, but I am not sure how can I send the value to the action since it will conflict, is there any angular2 way for such scenarios or have to go with jquery select value function?

<div class="row">
        <div class="input-field col s12">

                <textarea class="validate"
                (ngModel)="msgmodel.message" name="message"></textarea>

               <input type="text" class="hidden" 
                      (ngModel)="msgmodel.parentid" name="pid" 
                      [value]="poo.message.Messageid">
       </div>

       <button type="submit" (click)="sendmessage(msgmodel)" >Submit</button>
</div>
KB_
  • 2,113
  • 2
  • 26
  • 28
noobProgrammer
  • 2,884
  • 3
  • 17
  • 20
  • What does "send the value to the action" mean? What conflict? – Günter Zöchbauer Jun 16 '16 at 04:17
  • suppose i have to send the message text to the function in the script i can use model for that but since there are multiple forms it conflicts doesnt know where to take value from – noobProgrammer Jun 16 '16 at 14:20
  • @GünterZöchbauer can you help me on this http://stackoverflow.com/questions/37846946/how-to-push-and-update-deep-nested-values-in-angular2-and-maintain-ui-state – noobProgrammer Jun 16 '16 at 14:20

1 Answers1

0

You can simply add a hidden input with unique value in each form.

Soheil
  • 1,201
  • 2
  • 11
  • 18