Skip to content

Instantly share code, notes, and snippets.

@nsanta
Created November 1, 2012 23:49
Show Gist options
  • Save nsanta/3997645 to your computer and use it in GitHub Desktop.
Save nsanta/3997645 to your computer and use it in GitHub Desktop.
angular timeline blog post gists
app = angular.module(‘AwesomeApp’, [‘ngResource’]).
.config [‘$routeProvider’, ($route) →
$route.when(‘/sessions’, {
controller: ‘SessionCtrl’, # replace the controller function by the controller name
templateUrl: ‘/app/templates/sessions/login.html’
})
Session is a resource
@SessionCtrl = ($scope, $location, Session) →
$scope.login = →
Session.save $scope.session , (response) →
$location.path “/dashboard”
#app is the variable that contains the module “AwesomeApp”
app.controller ‘SessionCtrl’, ($scope, $location, Session) →
$scope.login = →
Session.save $scope.session , (response) →
$location.path “/dashboard”
app = angular.module(‘AwesomeApp’, [‘ngResource’]).
.config [‘$routeProvider’, ($route) →
$route.when(‘/sessions’, {
controller: SessionCtrl,
templateUrl: ‘/app/templates/sessions/login.html’
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment