Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. MyApp.factory('myService', function($http) {
  2.  
  3. return {
  4. findAll: function() {
  5. return $http.get('/findAll')
  6. .then(function(result) {
  7. return result.data;
  8. });
  9. }
  10. }
  11. });
  12.  
  13. MyApp.controller('UserController', ['$scope', '$http', 'myService', function($scope, $http, $log, myService) {
  14.  
  15. // Whatever I do with myService here it gets undefined.
  16. //$scope.test = myService.findAll();
  17. //myService.findAll();
  18.  
  19.  
  20. }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement