当我使用ng-repeat时,使用换行符打印数据。如何在打印时从数据中删除换行符。
<div ng-repeat = "x in names1">
{{x.status}}
</div>
答案 0 :(得分:0)
您应该使用 span
代替 div
,这将显示在一行
<强>样本强>
var app = angular.module('testApp',[]);
app.controller('testCtrl',function($scope){
$scope.names = ['AAA','BBB','CCC'];
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app= "testApp" ng-controller="testCtrl">
<span ng-repeat="friend in names">
{{friend}}
</span>
</body>