AngularJs的forEach循环

来源:互联网 发布:java保留小数点后一位 编辑:程序博客网 时间:2024/05/22 14:16
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><!-- 引入AngularJS库 --><scriptsrc="http://cdn.static.runoob.com/libs/angular.js/1.4.6/angular.min.js"></script></head><body><table ng-app="myTable" ng-controller="empController"><tr><th>雇员编号</th><th>雇员名称</th><th>薪水</th></tr><tr ng-repeat="i in emp"><td>{{i.eno}}</td><td>{{i.ename}}</td><td>{{i.sal}}</td></tr></table></body><script type="text/javascript">//获取app对象modulevar app = angular.module('myTable', []);//controller层会调用service层  控制层参数斥是提供服务的参数//$scope作用域  $location路径服务  $http发送ajax app.controller('empController', function($scope){$scope.emp=[{eno:1,ename:'zs',sal:1000},{eno:1,ename:'ls',sal:2000}];});</script></html>

原创粉丝点击