Commit b31ede29 authored by Evren Kutar's avatar Evren Kutar

get model form submit right way

parent f81f7692
app.config(['$routeProvider', function ($routeProvider) { app.config(['$routeProvider', function ($routeProvider) {
$routeProvider $routeProvider
.when('/login', { .when('/login', {
templateUrl: 'components/login/login.html', templateUrl: 'components/auth/login.html',
controller: 'LoginCtrl', controller: 'LoginCtrl',
resolve: { resolve: {
loadMyCtrl: ['$ocLazyLoad', function ($ocLazyLoad) { loadMyCtrl: ['$ocLazyLoad', function ($ocLazyLoad) {
......
...@@ -78,8 +78,7 @@ auth.controller('LoginCtrl', function ($scope, $q, $timeout, LoginService) { ...@@ -78,8 +78,7 @@ auth.controller('LoginCtrl', function ($scope, $q, $timeout, LoginService) {
$scope.onSubmit = function (form) { $scope.onSubmit = function (form) {
$scope.$broadcast('schemaFormValidate'); $scope.$broadcast('schemaFormValidate');
if (form.$valid) { if (form.$valid) {
var credentials = {email: form.email.$modelValue, password: form.password.$modelValue}; LoginService.login($scope.model);
LoginService.login(credentials);
} }
else { else {
console.log("not valid"); console.log("not valid");
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// TODO: login url change with correct one // TODO: login url change with correct one
login.factory('LoginService', function ($http, $rootScope, $location, $log, $cookies, Session, RESTURL) { auth.factory('LoginService', function ($http, $rootScope, $location, $log, $cookies, Session, RESTURL) {
var loginService = {}; var loginService = {};
loginService.login = function (credentials) { loginService.login = function (credentials) {
...@@ -58,7 +58,7 @@ login.factory('LoginService', function ($http, $rootScope, $location, $log, $coo ...@@ -58,7 +58,7 @@ login.factory('LoginService', function ($http, $rootScope, $location, $log, $coo
// TODO: initial service not working!! // TODO: initial service not working!!
login.service('Session', function () { auth.service('Session', function () {
this.create = function (sessionId, userId, userRole) { this.create = function (sessionId, userId, userRole) {
this.id = sessionId; this.id = sessionId;
this.userId = userId; this.userId = userId;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment