javascript - Why toString() is not working in ng-model attribute? -
how use tostring() on ng-model attribute in angularjs
my controller have array variable
like
$scope.usernamelist = ['a','b','c']; i want bind array string
i have tried below code working:-
$scope.usernamelist.tostring();//result a,b,c but when use tostring() in ng-model attribute, it's not working
<td style="text-align: center"><label ng-model="usernamelist.tostring()"></label></td>// not working but if use {{listofrolename.tostring()}}, it's working.
<td style="text-align: center">{{listofrolename.tostring()}}</td>//working why
tostring()not working inng-modelattribute?
ng-model used two-way databinding , can't reasonably bind result of function call.
if want display result, use ng-bind instead.
Comments
Post a Comment