highlight textarea angularjs
HTML
<div ng-app="" ng-controller="PruebaCtrl">
<textarea class="textFake" ng-model="geosTxt"></textarea>
<br/>
<div class="textFake">
<div ng-repeat="g in geos" ng-class="{highlight: g.highlight}">
{{g.nombre}}
</div>
</div>
</div>
CSS
div.textFake{
border: 1px solid #000;
}
.textFake{
width: 100px;
}
.highlight{
background-color: yellow;
}
JavaScript
function PruebaCtrl($scope){
$scope.editar = false;
$scope.geos = [
{nombre:"NY", highlight:true},
{nombre:"AZ", highlight:true}
];
var joinGeos = function(geos){
var response = "";
for (var k in geos){
response = response + geos[k].nombre + "\n";
};
return response;
};
$scope.geosTxt = joinGeos($scope.geos);
}