【发布时间】:2017-09-21 19:56:14
【问题描述】:
我正在将 Angular JS 用于一个简单的网络应用程序。
我有一个包含多个段落的 JSON 对象。因此,我需要将段落分成两行。我做了一些研究,找到了类似问题的一些答案,但由于没有将它们放在上下文中,我不理解它们。我试图查看 JSON 是否内置了强制换行的内容,因为那样可以,但我没有找到。
非常感谢您的帮助!
带有 Angular JS 的 HTML
<div class="bio">
{{exhibits[whichItem].bio}}
</div>
JSON
[
{
"name":"Name goes here",
"bio":"First long block of text goes here then it needs a break <br /> and the second long block of text is here."
}
]
AngularJS - controllers.js
var exhibitListControllers = angular.module('exhibitListControllers', ['ngAnimate']);
exhibitListControllers.controller('ListController', ['$scope', '$http', function($scope, $http){
$http.get('js/data.json').success(function(data) {
$scope.exhibits = data;
$scope.exhibitOrder = 'name';
});
}]);
【问题讨论】:
标签: javascript html angularjs json