javascript - AngularJS render content in a textarea after a click event -
i'm using angular js try , update value of <textarea>
using $http request after link clicked fetch content in controllers.js shown here:
$scope.setdocument = function(docid) { $http.get('docs/' + docid + '.json').success(function(data) { $scope.content = data.docdata; console.log('setting document: ' + data.docdata); }); }
the log statement shows right document data, result not rendered in text area on browser:
<textarea id="main-writer" ng-model="content" class="row-fluid" autofocus="true" cols="48" rows="24"></textarea>
what missing here?
should ng-model="content"
not "docdata"
edit: might want $scope.$apply(); after setting new content. although don't think necessary worth try. there nice chrome extension inspecting angularjs scopes , bindings. might want use see what's going on.
Comments
Post a Comment