Skip to content

Instantly share code, notes, and snippets.

@LarsBergqvist
Created May 15, 2016 12:24
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 LarsBergqvist/06304a1f09a2c70d196c9c343bab6c64 to your computer and use it in GitHub Desktop.
Save LarsBergqvist/06304a1f09a2c70d196c9c343bab6c64 to your computer and use it in GitHub Desktop.
AngularJS controller for rc outlet web app
var myApp = angular.module('myApp', []);
myApp.controller('OutletController', ['$scope', '$http', function($scope, $http) {
$scope.header = 'Outlets';
var getOutletInfo = function() {
$http.get("api/outlets").then(function(response) {
var outlets = response.data.outlets;
$scope.outlets = outlets;
}, function(error) {}
);
};
$scope.pressButton = function(id,action) {
$http.put("api/outlets/"+id, { state : action}).then(function(response) {
}, function(error) {}
);
}
getOutletInfo();
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment