angularJs循环打印

代码

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Document</title>
    <script src="js/vendor/angular-1.5.8.min.js"><//script>
</head>
<body ng-app="app">
<div ng-controller="ListCtrl">
    <ol>
        <li ng-repeat="name in names">
            {{name}}
        </li>
    </ol>
</div>
</body>

<script>
    var app = angular.module("app", []);

    app.controller("ListCtrl", function ($scope) {
        $scope.names = [
            "A",
            "B",
            "C",
            "D",
        ]
    });
<//script>
</html>

结果

A
B
C
D






发表于: 16天前   最后更新时间: 16天前   游览量:54
上一条: angularJs利用Directive实现View复用
下一条: angularJs事件

评论…


  • 评论…
    • in this conversation