Created
July 18, 2015 08:15
-
-
Save anonymous/487956892d760c17487c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en" class="no-js" ng-app="myapp"> <!--<![endif]--> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>My AngularJS App</title> | |
<meta name="description" content=""> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body> | |
<p>Use this template to start with an angular project</p> | |
<div ng-controller="MainCtrl"> | |
<p>Hello, {{name}}!</p> | |
<table> | |
<thead> | |
<tr> | |
<th ng-repeat="(k,v) in data[0]">{{k}}</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr ng-repeat="item in data"> | |
<td ng-repeat="(prop, value) in item" ng-init="isArr = isArray(value)"> | |
<table ng-if="isArr"> | |
<thead> | |
<tr> | |
<th ng-repeat="(sh, sv) in value[0]">{{sh}}</th> | |
</tr> | |
</thead> | |
<tbody> | |
<tr ng-repeat="sub in value"> | |
<td ng-repeat="(sk, sv) in sub">{{sv}}</td> | |
</tr> | |
</tbody> | |
</table> | |
<span ng-if="!isArr">{{value}}</span> | |
</td> | |
</tr> | |
</tbody> | |
</table> | |
</div> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.js"></script> | |
<script src="main.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('myapp', []) | |
.controller('MainCtrl', function($scope, foo){ | |
$scope.name = 'World'; | |
$scope.data = foo; | |
$scope.isArray = angular.isArray; | |
}) | |
.value('foo', [ | |
{ | |
"col1": "data", | |
"col2": "data", | |
"MyValues": [{"Id":100,"Value":"Save"}, {"Id":100,"Value":"Save"}] | |
}, | |
{ | |
"col1": "data", | |
"col2": "data", | |
"MyValues": [{"Id":101,"Value":"Save"}, {"Id":101,"Value":"Save"}] | |
} | |
]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment