Skip to content

Instantly share code, notes, and snippets.

@torufurukawa
Last active December 20, 2015 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torufurukawa/6161212 to your computer and use it in GitHub Desktop.
Save torufurukawa/6161212 to your computer and use it in GitHub Desktop.
angularjs service creation
angular.module('feiz', [], function($provide) {
$provide.factory('get', ['$http', function(http) {
return function(scope) {
http({url:'http://oldriver.org/index.html', method:'GET'}).
error(function(){
scope.hoge = "azuma";
});
};
}]);
});
var FeizController = function($scope, get) {
get($scope);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment