从Angular Js中的内联Json数据填充表
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了从Angular Js中的内联Json数据填充表相关的知识,希望对你有一定的参考价值。
Populating Table from Inline Json Data in Angular js
<html ng-app="tableJson"> <head > <link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"> <!--<script src="../angular.1.2.14.min.js"></script>--> <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.19/angular.min.js"></script> <title>Angular Framework</title> </head> <body> <div ng-controller="tableJsonCtrl"> <table border="1" cellpadding="10"> <tr ng-repeat="items in phones"> <td>{{items.name}}</td> <td>{{items.snippet}}</td> <td>{{items.age}}</td> </tr> </table> </div> <script> var tableJson = angular.module('tableJson', []); tableJson.controller('tableJsonCtrl', function($scope){ $scope.phones = [ { "name": "Nexus S", "snippet": "Fast just got faster with Nexus S.", "age": 0 }, { "name": "Apple iPhone 4S (White) (8 GB)", "snippet": "3.5 Inch Widescreen Diagonal", "age": 1 }, { "name": "Samsung Galaxy Core 2 (White)", "age": 2 }, { "name": "Micromax Canvas HD Plus A190, white gold", "snippet": "4.76 GB for mass storage", "age": 2 } ]; }) </script> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> </body> </html>
以上是关于从Angular Js中的内联Json数据填充表的主要内容,如果未能解决你的问题,请参考以下文章
使用Angular.js中的cookie填充选择的相关下拉列表
如何在 `angular.json` 中配置内联样式和 html 模板?