Browse Source

Adding factory method for getting sample data from RESTful Django endpoint

David Leonard 10 năm trước cách đây
mục cha
commit
015a5548ad
1 tập tin đã thay đổi với 12 bổ sung0 xóa
  1. 12 0
      public/scripts/factories/restAppFactory.js

+ 12 - 0
public/scripts/factories/restAppFactory.js

@@ -0,0 +1,12 @@
+'use strict';
+
+restApp.factory('restAppFactory', function($http) {
+    return {
+        get: function() {
+            return $http({
+                url: 'http://127.0.0.1:8000/hackathon/snippets/',
+                method: 'GET',
+            });
+        }
+    };
+});