javascript - can't getting textarea value using AngularJs -


<tr class="labels">     <td nowrap="nowrap">address</td>     <td nowrap="nowrap"><label for="tbaddress"></label>         <textarea name="tbaddress" id="tbaddress" cols="39" rows="5" ng-model="$parent.tbaddress"></textarea>      </td>  </tr> <tr>     <td>&nbsp;</td>     <td align="right">         <input type="submit" name="button" id="button" value="submit record" class="btns" />         <input type="reset" name="button2" id="button2" value="cancel" class="btns" />     </td> </tr> 

i'm not able textarea value using angularjs. input text fields getting through controller except textarea. doing wrong ?

alert($scope.tbaddress); var thisdata = {     'name': $scope.tbfn,     'company': $scope.tbcompany,     'designation': $scope.tbdesignation,     'email': $scope.tbemail,     'phone': $scope.tbphone,     'mobile': $scope.tbmobile,     'address': $scope.tbaddress }; 

it's alert undefined...

if have alert($scope.tbaddress); positioned right there, of course it'll end undefined. nothing has been assigned $scope.tbaddress @ point. (but maybe have defined earlier, it's not being shown in code).

i didn't have problem getting work. wrapped alert in function bound submit button. i'm able value. see example.

i took liberty of changing $scope bit. it's recommended every ngmodel has . in it's name. rather tbaddress should tb.address. has how angular inheritance handled.

refer to:


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -