Reputation: 3596
I am trying to load text file config1100.txt to textarea (on initial page load), see below. Also tried http://localhost:3000/data/config1100.txt (file is avail), no success so far.
<p><textarea ng-src="data/config1100.txt" type="text" id="textarea" model="myTextArea" cols="80" rows="10" >
</textarea></p>
Upvotes: 0
Views: 308
Reputation: 11198
like this irom:
var app = angular.module("angularApp", []);
app.controller("myConfigGenCtrl", function($scope, customService)
{
customService.getData().then(function(response)
{
$scope.myTextArea = response.data; //-- scope.myTextArea is your ng-model on your text area
});
});
app.service('customService',function($http)
{
this.getData = function()
{
return $http.get('localhost:3000/data/config1100.txt');
};
});
also, your text area attribute model
should be ng-model
Upvotes: 1