Total Pageviews

2018/05/05

[Angular] How to show data via ng-repeat in horizontal ?

Problem
Assume I have an String array.
    $scope.names = ['朴道京', '吳海英', '李振尚', '朴秀京', '朴勳'];

I would like to show these names in HTML page via ng-repeat, here has the code snippet:

    <div class="row">
      <div class="col-sm-offset-1 col-sm-4">
         <div data-ng-repeat="name in names">
               <span>{{name}}</span>
         </div>
      </div>
    </div>

But it display in vertical way, how to display in horizontal way?


How-To
Use span instead of div, the updated code snippet are as bellows:
   <div class="row">
     <div class="col-sm-offset-1 col-sm-4">
        <span data-ng-repeat="name in names">
              <span>{{name}}</span>
        </span>
     </div>
   </div>

Here has the screenshot:




No comments: