首页 > 学院 > 开发设计 > 正文

简单模板ng-repeat的使用

2019-11-09 13:49:33
字体:
来源:转载
供稿:网友
<!DOCTYPE html><html ng-app="phonecatApp"><head>    <meta charset="UTF-8">    <title>Title</title>    <script src="js/lib/angular/angular.min.js"></script>    <style>        li>span:first-child{color:red;font-size:22px;}    </style></head><body ng-controller="PhoneListController"><ul>    <li ng-repeat="phone in phones">        <span>{{phone.name}}</span>        <span>{{phone.snippet}}</span>    </li></ul><script>    var app = angular.module("phonecatApp", []);    app.controller("PhoneListController", function ph($scope) {        $scope.phones = [            {                name: '【Nexus S】',                snippet: 'Fast just got faster with Nexus S.'            },            {                name: '【Motorola XOOM™ with Wi-Fi】',                snippet: 'The Next, Next Generation tablet.'            },            {                name: '【MOTOROLA XOOM™】',                snippet: 'The Next, Next Generation tablet.'            }        ];    });</script></body></html>
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表