Ready to start development
diff --git a/mCordPortal/src/app/view/login/login.js b/mCordPortal/src/app/view/login/login.js
index 170abcf..348fc42 100644
--- a/mCordPortal/src/app/view/login/login.js
+++ b/mCordPortal/src/app/view/login/login.js
@@ -17,31 +17,36 @@
(function () {
'use strict';
- angular.module('cordLogin', [])
- .controller('CordLoginCtrl', function ($log, $scope, $resource, $location, $window, User) {
+ angular.module('mCord')
+ .directive('cordLogin', function ($log, $location, User) {
- $scope.page.curr = 'login';
- $scope.loading = false;
+ return {
+ restrict: 'E',
+ templateUrl: 'app/view/login/login.html',
+ controllerAs: 'vm',
+ controller: function(){
- $scope.login = function () {
- if ($scope.email && $scope.password) {
- //getResource($scope.email);
- $scope.loading = true;
- User.login($scope.email, $scope.password)
- .then(function(user){
- $location.url('/');
- })
- .catch(function(e){
- $scope.error = true;
- })
- .finally(function(){
- $scope.loading = false;
- });;
+ this.loading = false;
- $scope.shared.login = $scope.email;
+ this.login = () => {
+ if (this.email && this.password) {
+ this.loading = true;
+ User.login(this.email, this.password)
+ .then(() => {
+ $location.url('/');
+ })
+ .catch(() => {
+ this.error = true;
+ })
+ .finally(() => {
+ this.loading = false;
+ });
+ }
+ };
+
+ $log.debug('Cord Login Ctrl has been created.');
}
- };
+ }
- $log.debug('Cord Login Ctrl has been created.');
});
}());