Skip to content

Instantly share code, notes, and snippets.

@pfallasro
Last active August 29, 2015 13:56
Show Gist options
  • Save pfallasro/9313697 to your computer and use it in GitHub Desktop.
Save pfallasro/9313697 to your computer and use it in GitHub Desktop.
Basic AngulasJS Service
var myApp = angular.module('myApp', []);
//This is the service
myApp.Factory('Data', function () {
return {message:"I'm data from a service"}
})
//This is the controller
function FirstCntrl ($scope, Data) {
$scope.data = Data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment