Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.controller('MainCtrl', function ($scope, $state,$location,$http,user) {
- $scope.user = {
- nome: user.getProperty()
- };
- $scope.showRegister = function () {
- $state.go('register');
- }
- $scope.showLogin = function () {
- $state.go('login');
- }
- });
- app.controller('loginController', function ($scope, $http, $state,user) {
- $scope.login = function () {
- var data = {};
- data.password = $scope.loja.password;
- data.email = $scope.loja.email;
- $http.post('http://localhost:8080/login/',data)
- .success(function (data) {
- console.log(data);
- user.setProperty(data.nome);
- $state.go('home');
- })
- .error(function (statusText) {
- console.log("failed");
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement