Skip to content

Instantly share code, notes, and snippets.

@AlphaGit
Created April 30, 2014 02:11
Show Gist options
  • Save AlphaGit/09af98de7ac11cf7a1fe to your computer and use it in GitHub Desktop.
Save AlphaGit/09af98de7ac11cf7a1fe to your computer and use it in GitHub Desktop.
Example controller in AngularJS, declared separatedly
var MyController = function($scope, ApiService) {
$scope.awesomeThings = ['everything']; // everything is awesome
$scope.randomStuff = null;
ApiService.getStuff('random').then(function(retrievedStuff) {
$scope.randomStuff = retrievedStuff;
});
};
angular.module('MyApp').controller('MyController', MyController);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment