Skip to content

Instantly share code, notes, and snippets.

@sunkay
Created April 21, 2013 20:54
Show Gist options
  • Save sunkay/5431044 to your computer and use it in GitHub Desktop.
Save sunkay/5431044 to your computer and use it in GitHub Desktop.
main controller which provides the routes & models
// Global app module listing all its dependencies
var cotdServices = angular.module('cotd', ['DeviceModule']);
// setup mappings routes and templates
function cotdRouteConfig($routeProvider){
$routeProvider.
when('/', {
controller: deviceListController,
templateUrl: 'listDevices.html'
}).
otherwise({
redirectTo: '/'
});
}
cotdServices.config(cotdRouteConfig);
// controllers
function deviceListController($scope, Devices)
{
$scope.devices = Devices.query();
$scope.remove = function(index){
$scope.devices.splice(index, 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment