c# - Display values in textarea separated with newline after post and reuse of values -
i have solution in mvc, asp.net use of angularjs, possible input values textarea , post them server. can receive values server , show them in textarea in view using ng-model. unsure of how display them newline , reuse them (re-post them right away).
1) first of user able input values in textarea , split them return button. done ng-list="/\n/":
<textarea rows="10" cols="80" id="autogenerateinputfield" ng-model="fighterlist" ng-list="/\n/" /> 2) post these values through angularjs , saves them in database.
3) can these values json. convert them list , puts them fighterlist using angularjs:
$scope.refreshlisttournamenttree = function (categoryid) { var serviceurl = "/api/match" + (categoryid ? "/" + categoryid : ""); $http({ method: 'get', url: serviceurl }).success(function (data, status, headers, config) { $scope.treegenerated = data.length; $scope.totalmatches = data; var listoffighters = []; if (data.length > 0) { $scope.finalmatch = [buildhierarchy(data)[0]]; (var = 0; data.length > i; i++){ fighter1 = data[i].fighter1; fighter2 = data[i].fighter2; listoffighters.push(fighter1); listoffighters.push(fighter2); } } else { $scope.finalmatch = []; } $scope.fighterlist = listoffighters; $scope.loading = false; }).error(function (data, status, headers, config) { }); } now list shown in textarea values separated "," , not new line. have created fiddle shows simplyfied version of question:
http://jsfiddle.net/jtf3m/256/ 

so question: how display values fighterlist in textarea separated newline , can reuse values?
can't add join? please see fiddle updated: http://jsfiddle.net/jtf3m/261/
please @ alternative way using filter , ng-init: http://jsfiddle.net/7516qere/
Comments
Post a Comment