javascript - dropdown and textarea binding with AngularJS -


i have simple scenario , wanted use angularjs that. not able 1 right.

i retrieving data database , directly writing view inside dropdown. based on item selected, want populate value textbook.

so code follows:

<select>   <option selected="selected" disabled="disabled">dropdown</option>   @foreach (system.data.datarow row in viewbag.template.rows)   {     <option value="@row[1].tostring()">@row[0].tostring()</option>   } </select> <textarea></textarea> 

i trying achieve following:

whatever option user select, corresponding value item populated text area.

please suggest how can achieve using angularjs.

you should use ngmodel directive that, same both select , textarea:

<select ng-model="selectmodel">   <option selected="selected" disabled="disabled">dropdown</option>   @foreach (system.data.datarow row in viewbag.template.rows)   {     <option value="@row[1].tostring()">@row[0].tostring()</option>   } </select> <textarea ng-model="selectmodel"></textarea> 

demo: http://plnkr.co/edit/xos6wuyqdr3zlftbq3rb?p=preview


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -