ng-reapte指令遍历

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <style media="screen">
      .container{
        width: 100%;
        height: 100%;
      }
      .container img{
        width: 150px;
        height: 100px;
      }
      span{
        display: block;
        width: 100%;
        height: 100px;
      }
    </style>

    <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js"></script>

  </head>
  <body>
    <div data-ng-app="" data-ng-init="names=[
    {
      url:'./1.jpg'
    },
    {
      url:'./1.jpg'
    }
    ,
    {
      url:'./1.jpg'
    }
    ,
    {
      url:'./1.jpg'
    }
    ,
    {
      url:'./1.jpg'
    }]"
    >
    <span></span>
    <img data-ng-repeat="x in names" ng-src={{x.url}} alt="">
  </div>
</ul>
  </body>
</html>

猜你喜欢

转载自www.cnblogs.com/liuw-flexi/p/12071508.html
今日推荐