example for $resource using 0.9.1 API
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 31 Oct 2010 19:56:46 +0000 (20:56 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sun, 31 Oct 2010 19:56:46 +0000 (20:56 +0100)
templates/Cookbook/7-AddressBook.html.ep [new file with mode: 0644]

diff --git a/templates/Cookbook/7-AddressBook.html.ep b/templates/Cookbook/7-AddressBook.html.ep
new file mode 100644 (file)
index 0000000..79e37d6
--- /dev/null
@@ -0,0 +1,20 @@
+<script type="text/javascript">
+    MyController = function($resource) {
+      this.People = $resource('/data/AddressBook/people');
+    };
+    MyController.$inject = ['$resource'];
+       MyController.prototype = {
+               fetchPeople: function() {
+                       this.people = this.People.query();
+               }
+       };
+</script>
+
+<div ng:controller="MyController" ng:init="$window.$root = this">
+       <h1>Address Book </h1>
+       <button ng:click="fetchPeople()">fetch</button>
+       <hr/>
+       <ul>
+               <li ng:repeat="person in people">{{person.name}}</li>
+       </ul>
+</div>