Selaa lähdekoodia

Implementing controller for getting github user data

David Leonard 10 vuotta sitten
vanhempi
commit
467286b148
2 muutettua tiedostoa jossa 12 lisäystä ja 0 poistoa
  1. 2 0
      angular/index.html
  2. 10 0
      angular/scripts/controllers/githubUserController.js

+ 2 - 0
angular/index.html

@@ -24,9 +24,11 @@
         <!-- Controllers --> 
         <script src="scripts/controllers/appController.js"></script>
         <script src="scripts/controllers/restAppController.js"></script>
+        <script src="scripts/controllers/githubUserController.js"></script>
 
         <!-- Factories -->
         <script src="scripts/factories/restAppFactory.js"></script>
+        <script src="scripts/factories/githubUserFactory.js"></script>
 
     </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);
+    });
+});