Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by bogdana on 1/14/17.
- */
- app.controller("loginController", function ($scope, $http) {
- $scope.user = {username: '', password: ''};
- $scope.onLogIn = function () {
- $http({
- method: 'POST',
- url: '/api/login',
- headers: {'Content-Type': 'application/x-www-form-urlencoded'},
- transformRequest: function(obj) {
- var str = [];
- for(var p in obj)
- str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
- return str.join("&");
- },
- data: $scope.user
- }).then(function (data) {
- alert(data.username);
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement