瀏覽代碼

Implementing controller for getting github user data

David Leonard 10 年之前
父節點
當前提交
467286b148
共有 2 個文件被更改,包括 12 次插入0 次删除
  1. 2 0
      angular/index.html
  2. 10 0
      angular/scripts/controllers/githubUserController.js

+ 2 - 0
angular/index.html

@@ -24,9 +24,11 @@
         <!-- Controllers --> 
         <!-- Controllers --> 
         <script src="scripts/controllers/appController.js"></script>
         <script src="scripts/controllers/appController.js"></script>
         <script src="scripts/controllers/restAppController.js"></script>
         <script src="scripts/controllers/restAppController.js"></script>
+        <script src="scripts/controllers/githubUserController.js"></script>
 
 
         <!-- Factories -->
         <!-- Factories -->
         <script src="scripts/factories/restAppFactory.js"></script>
         <script src="scripts/factories/restAppFactory.js"></script>
+        <script src="scripts/factories/githubUserFactory.js"></script>
 
 
     </head>
     </head>
 
 

+ 10 - 0
angular/scripts/controllers/githubUserController.js

@@ -0,0 +1,10 @@
+'use strict';
+
+restApp.controller('githubUserController', function($scope, githubUserFactory) {
+    $scope.githubUser = {};
+    
+    $scope.githubUser = githubUserFactory.get().success(function(data) {
+    	$scope.githubUser = data;
+    	console.log(data);
+    });
+});