Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用angularjs列出项目_Javascript_Angularjs - Fatal编程技术网

Javascript 使用angularjs列出项目

Javascript 使用angularjs列出项目,javascript,angularjs,Javascript,Angularjs,我想水平显示三个列表。如果使用angularjs,有人能给我一些提示吗 这是我想在页面中显示的: List1 List2 List3 *list1_item1 *list2_item1 *list3_item1 *list1_item2 *list2_item2 *list3_item2 *list1_item3 *list2_item3 *list3_item3 列表中还

我想水平显示三个列表。如果使用angularjs,有人能给我一些提示吗

这是我想在页面中显示的:

  List1              List2             List3

*list1_item1     *list2_item1        *list3_item1
*list1_item2     *list2_item2        *list3_item2
*list1_item3     *list2_item3        *list3_item3
列表中还显示了一些边界线


感谢您对三个水平放置的div中的每一个使用ng repeat并将列表放入。

您可以使用纯CSS来使用它。把你的潜水艇漂到左边。 如果需要,请使用ng repeat,如

<div ng-repeat="list in lists">
     <li ng-repeat="item in list"> {{item.name}} </li>
</div>




<div style="float:left;">
    <h1>LIST ITEM 1</h1>
    <li>list1_item1 </li>
    <li> list1_item2 </li>
    <li> list1_item3 </li> 
  </div>

  <div style="float:left">
    <h1>LIST ITEM 2</h1>
    <li>list2_item1 </li>
    <li> list2_item2 </li>
    <li> list2_item3 </li> 
  </div>

  <div style="float:left;">
    <h1>LIST ITEM 3</h1>
    <li>list3_item1 </li>
    <li> list3_item2 </li>
    <li> list3_item3 </li> 
  </div>

  • {{item.name}
  • 清单项目1
  • 清单1_项目1
  • 清单1_项目2
  • 清单1_项目3
  • 清单项目2
  • 清单2_项目1
  • 清单2_项目2
  • 清单2_项目3
  • 清单项目3
  • 清单3_项目1
  • 清单3_项目2
  • 清单3_项目3
  • 这是它的一个扑克牌


    您要找的是指令,只有3个div和一些简单的css

    这里有一个你想要的小演示

    HTML

    <h3>Three Lists</h3>
    <div ng-app="threeListsApp" ng-controller="ctrl">
      <ul>
        <div class="itemClmn">
          <h4>items A</h4>
          <p ng-repeat="(country,goals) in itemsA">{{country}} : {{goals}}</p>
        </div>
        <div class="itemClmn">
          <h4>items B</h4>
          <p ng-repeat="bItem in itemsB">{{bItem.name}}: {{bItem.gender}}</p>
        </div>
        <div class="itemClmn">
          <h4>items C</h4>
          <p ng-repeat="cItem in itemsC">{{cItem[0]}}: {{cItem[1]}}</p>
        </div>
      </ul>
    </div>
    
    JS

    .itemClmn
    {
      position: relative;
      float: left; 
      width: 130px;
    }
    
    var a = {
        "India": "2",
        "England": "2",
        "Brazil": "3"
    };
    var b = [{
        name: "Jim",
        gender: "M"
    }, {
        name: "Jane",
        gender: "F"
    }, {
        name: "Robyn",
        gender: "F"
    }];
    var c = [
        ["Blue", "1"],
        ["Green", "2"],
        ["Red", "3"]
    ];
    
    angular
    .module('threeListsApp', [])
    .controller('ctrl', ['$scope', function ($scope) {
        $scope.itemsA = a;
        $scope.itemsB = b;
        $scope.itemsC = c;
    }]);
    

    没有什么不同于任何其他角度。具体问题是什么