Hi, thanks I think I have it..I'm up to hear though. I just can't return it
*Factory*
(function(){
//Register the factory as a function
var testFactory = function($http){
//Create empty wrapper object
var factory = {};
factory.getHotels = function(){
//Puts the hotels object into the factory object
var url =
"http://api.ean.com/ean-services/rs/hotel/v3/list?cid=55505&minorRev=30&apiKey=k5drjfmwg6j6fgbadhccb9s5&locale=en_US¤cyCode=AUD&callback=JSON_CALLBACK";
$http.jsonp(url)
.success(function(data){
//return returnedData = data;
});
return(something that I cant get to);
};
//Returns factory ready for the controller
return factory;
};
testFactory.$inject = ['$http'];
//Register the object with Angular.js
angular.module('achApp')
.factory('testFactory', testFactory);
}());
*Controller*
(function(){
var HotelsController = function($scope, hotelsFactory){
//Bring an empty object into the scope
$scope.hotels = [];
function init(){
//Puts the factory into the scope via $scope.hotels
$scope.hotels = hotelsFactory.getHotels();
}
//Run the function
init();
};
HotelsController.$inject = ['$scope', 'hotelsFactory'];
angular.module('achApp')
.controller('HotelsController', HotelsController);
}());
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.