<!DOCTYPE html>
<html ng-app>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="angular.min.js"></script>
<script>
function TextareaCtrl($scope)
{
var str="啦啦11范德萨范德萨\nfadsfadsfad\nfdfadfa\nfdafa";
$scope.name=str.replace(/\n/g,"<br/>");
}
</script>
</head>
<body>
<p ng-controller="TextareaCtrl">
<p>{{name}}</p>
</p>
</body>
</html>
结果:
啦啦11范德萨范德萨<br/>fadsfadsfad<br/>fdfadfa<br/>fdafa
You need to use ng-bind-html
The reason for non-parsing is that angularjs filters the HTML and changes the < > symbol into & l t; & g t;, as evidenced by the picture. I checked and it turns out that the filter can be disabled. I'm really not familiar with angularjs, so I can't help you.
Tweet it