AngularJS Scope 表格
来源:互联网 发布:c语言ascii码 编辑:程序博客网 时间:2024/06/06 01:10
<!DOCTYPE html><html><head lang="en"> <meta charset="UTF-8"> <script type="text/javascript" src="angular-1.3.0.js"></script> <title></title> <script type="text/javascript"> var app=angular.module("myApp", []); app.controller("bookCtrl", function($scope,$http){ $http({ method:"GET", url:"book.json" }).success(function(data, status, headers, config){ $scope.book=data; }).error(function(data, status, headers, config){ console.log(status); }); }); app.controller("bookListCtrl", function($scope, $http){ $http({ method:"GET", url:"books.json" }).success(function (data, status, headers, config){ $scope.books=data; }).error(function (data, status, headers, config){ console.log(status); }); }); </script></head><body ng-app="myApp"><div ng-controller="bookCtrl"> <ul> <li>ID:{{ book.id }}</li> <li>标题:{{ book.title }}</li> <li>类型:{{ book.type }}</li> <li>描述:{{ book.description }}</li> <li>图片:<img src="{{ book.picture }}"/></li> <li>是否推荐:{{ book.isRecommend }}</li> <li>上架时间:{{ book.dtCreated }}</li> </ul></div><div ng-controller="bookListCtrl"> <table border="1"> <tr> <th>NO</th> <th>ID</th> <th>标题</th> <th>是否推荐</th> <th>价格</th> </tr> <tbody ng-repeat="book in books"> <tr> <td>{{ $index }}</td> <td>{{ book.id }}</td> <td>{{ book.title }}</td> <td> <i ng-if="book.isRecommend">是</i> <i ng-if="!book.isRecommend">否</i> </td> <td>{{ book.price }}</td> </tr> </tbody> </table></div></body></html>
阅读全文
0 0
- AngularJS Scope 表格
- AngularJS scope
- AngularJs--Scope
- AngularJS: $scope
- AngularJS 中的scope($scope)
- Angularjs中scope与$scope
- AngularJs学习笔记--Scope
- angularjs $scope.$apply()
- AngularJS and scope.$apply
- AngularJS中$scope用法
- angularjs基础—scope
- AngularJS 的 Scope
- AngularJs学习笔记--Scope
- AngularJS Scope(作用域)
- AngularJS scope destroy 详解
- AngularJS Scope(作用域)
- Angularjs Scope 详解
- AngularJS Scope 继承解析
- [leetcode] 21. Merge Two Sorted Lists
- Spring Data Jpa 异常:PropertyReferenceException: No property xx for type yy
- 测试连接失败,因为初始化提供程序时发生错误
- AngularJS的请求本地的json串并显示在表单上
- 实验四:用可重用的链表模块来实现命令行菜单小程序V2.5
- AngularJS Scope 表格
- Python基础详解
- OpenCV3_C++_Perspective()透视形式投影 实例
- codevs 1154 能量项链
- python 调用函数
- java.lang.IllegalStateException: getOutputStream() has already been called for this respons解决办法
- 计算机视觉自学笔记
- bzoj1055 [HAOI2008]玩具取名
- MySQL 遍历结果集