Skip to content

Instantly share code, notes, and snippets.

@ctmcquilkin
ctmcquilkin / Nested_ng-repeats
Last active August 3, 2016 14:24
An example of how to get data out of an elaborate JSON file from SO: http://stackoverflow.com/questions/19839743/nested-ng-repeat
<!DOCTYPE html>
<html lang="en" ng-app="root">
<head>
<title>Crazy nested ng-repeat example</title>
</head>
<body ng-controller="repeatCtrl">
<div ng-repeat="week in myData">
<div ng-repeat="day in week.days">
{{day.dow}} - {{day.templateDay}}
<b>Jobs:</b><br/>
function pushSomething(ref) {
// Let's push something. push() returns a reference that you can hold onto!
var justPushed = ref.push({test: "push"});
// We return a reference, but you can also return the name of the newly
// created object with .name().
return justPushed;
}
function removeItem(ref) {
// Now we can get back to that item we just pushed via .child().