I hereby claim:
- I am miyamotodev123 on github.
- I am kmiyamoto (https://keybase.io/kmiyamoto) on keybase.
- I have a public key ASC_hAj0SX345Rd46nryGey7Ddjc-n7SzcM3TSGthUfPuQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
<div class="col-sm-6 col-sm-offset-3"> | |
<h1><span class="fa fa-sign-in"></span> Login</h1> | |
<div growl></div> | |
<!-- LOGIN FORM --> | |
<form ng-submit="login.login()" ng-controller="LoginControllerTwo as login"> | |
<div class="form-group"> | |
<label>Email</label> |
(function() { | |
angular.module('app') | |
// injected 'growl' as a dependency to be used by the LoginController | |
.controller('LoginController', ['$location', 'AuthService', 'growl', | |
function($location, AuthService, growl) { | |
var vm = this; | |
vm.login = function() { | |
var login_data = { | |
email: vm.email, |
// defining our angular app, the first arguement is the name of our application | |
// second argument is an array that loads the dependencies into the application | |
(function() { | |
angular.module('app', ['ngRoute', 'angular-growl']); | |
})(); |
(function() { | |
/** | |
* angular-growl - v0.4.0 - 2013-11-19 | |
* https://github.com/marcorinck/angular-growl | |
* Copyright (c) 2013 Marco Rinck; Licensed MIT | |
*/ | |
angular.module('angular-growl', []); | |
angular.module('angular-growl').directive('growl', [ | |
'$rootScope', | |
function ($rootScope) { |
<!doctype html> | |
<html ng-app="app"> | |
<head> | |
<title>Node Authentication</title> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> | |
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular-route.min.js"></script> | |
<script src="lib/growl.js"></script> |
(function() { | |
angular.module('app') | |
.factory('AuthService', ['$http', | |
function($http) { | |
var AuthService = {}; | |
AuthService.login = function(data) { | |
return $http.post('/login', data) | |
} |
(function() { | |
angular.module('app') | |
.controller('LoginController', ['$location', 'AuthService', | |
function($location, AuthService) { | |
var vm = this; | |
vm.login = function() { | |
var login_data = { | |
email: vm.email, | |
password: vm.password |
(function(){ | |
angular.module('app') | |
.directive('logout', ['$http', function($http) { | |
return { | |
restrict: 'A', | |
link: function(scope, element, attrs) { | |
element.on('click', function(e) { | |
$http.post('/logout'); | |
}); | |
} |
(function() { | |
angular.module('app') | |
.controller('ProfileController', ['$http', '$scope', '$location', | |
function($http, $scope, $location) { | |
$http.get('/api/userData') | |
.success(function(response) { | |
console.log('user data success') | |
console.log(response) | |
$scope.user = response; //Expose the user data to your angular scope | |
}) |