angular.module('app').controller('LoginController', ['$location', '$scope', 'loginService','$log', function ($location, $scope, loginService,$log) {
    var ctrl = this;


    ctrl.loginFlag = true;

    ctrl.login = function () {
        loginService.login(ctrl.userName, ctrl.password).success(function (response) {
            if (response.meta.success) {
                loginService.gotoIndex();

            } else {
                ctrl.loginFlag = false;
            }

        }).error(function (e) {
            $log.error(e);
        });
    };

}]);