我想用ng-repeat将项目附加到同一行,但它似乎在新行上添加了项目.在下面的示例中,我希望它们位于同一行,如:
“约翰25岁.杰西30岁.约翰娜28岁.”
结果是:
25岁的约翰.
杰西30岁.
约翰娜,28岁.
我怎么能做到这一点?
<div ng-init="friends = [ {name:'John',age:25,gender:'boy'},{name:'Jessie',age:30,gender:'girl'},{name:'Johanna',age:28,gender:'girl'} ]"> <div ng-repeat="friend in friends"> {{friend.name}} who is {{friend.age}} years old. </div>
石
试试这个
原文链接:/angularjs/140264.html<div ng-repeat="friend in friends" style="float:left"> {{friend.name}} who is {{friend.age}} years old. </div>
要么
<span ng-repeat="friend in friends"> {{friend.name}} who is {{friend.age}} years old. </span>
默认情况下,DIV呈现为display:block和SPAN as display:inline