【发布时间】:2020-02-26 18:18:54
【问题描述】:
我需要显示带有换行符的文本,这是脚本
<script>
var app = angular.module('MyApp', []);
app.controller('Ctrl', function ($scope) {
console.log('Controller is executed');
$scope.btnClick = function () {
console.log($scope.desc);
}
$scope.ShowData = function () {
$scope.text = $scope.desc;
}
});
</script>
这是html代码
<body ng-controller="Ctrl">
<form>
<textarea ng-model="desc" cols="105" rows="15"></textarea>
<button ng-click="btnClick()">Submit</button>
<button ng-click="ShowData()">Show</button>
</form>
<div ng-bind="text"></div>
【问题讨论】: