Skip to content

Instantly share code, notes, and snippets.

@ondrek
Last active August 29, 2015 14:09
Show Gist options
  • Save ondrek/c7089772ab22401c1744 to your computer and use it in GitHub Desktop.
Save ondrek/c7089772ab22401c1744 to your computer and use it in GitHub Desktop.
Samples for Code Styles
;(function(){
/**
* Recovery Controller provides functionality for:
* (1) resetting password, (2) setting a new one and (3) switching views
*/
'use strict';
var RecoveryController = function($scope, $location, Auth){
var self = this;
self.errors = {};
self.user = {};
self.onLoggedUser(Auth, $location);
};
RecoveryController.prototype.onLoggedUser = function(Auth, $location){
var self = this;
this.submitted = true;
if(this.$valid) {
var loginOnRequest = Auth.login({
email: self.user.email,
password: self.user.password
});
loginOnRequest.then(function() {
$location.path('/');
});
loginOnRequest.catch(self.onInvalidForm);
}
};
RecoveryController.prototype.onInvalidForm = function(){
};
angular.module('webApp').controller('RecoveryCtrl',[
'$scope', '$location', 'Auth', RecoveryController
]);
})();
;(function(){
/**
* Live betting templates and downlading data from the API
* Provides all routing for the Live Module
*/
'use strict';
var configuration = function ($routeProvider){
$routeProvider.when(lib.urls.LIFE_ROOT, {
templateUrl: lib.templates.LIVE_LIST
});
$routeProvider.when(lib.urls.LIVE_WILDCARD, {
templateUrl: lib.templates.LIVE_DETAILS
});
};
angular.module('webApp').config(configuration);
})();
@ondrek
Copy link
Author

ondrek commented Nov 10, 2014

//    where:
//    lib.templates.LIVE_LIST = 'app/live/live-list.html'
//    lib.templates.LIVE_DETAILS = 'app/live/live-detail.html'
//    lib.urls.LIFE_ROOT = '/live'
//    lib.urls.LIVE_WILDCARD = '/live/:id'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment