Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'use strict';
- angular.module('myApp.view1', ['ngRoute'])
- .config(['$routeProvider', function($routeProvider) {
- $routeProvider.when('/view1', {
- templateUrl: 'view1/view1.html',
- controller: 'AuthCtrl as auth'
- });
- }])
- .controller('AuthCtrl', ['$http',function($http) {
- let auth = this;
- auth.login = function() {
- console.log(auth.username)
- console.log(auth.password)
- $http.post('/js/cake/login',
- {username: auth.username,password: auth.password},
- {headers:{'Content-Type': 'application/x-www-form-urlencoded'}}).then(function () {
- //success
- console.log(arguments)
- }, function() {
- //fail
- console.log(arguments)
- })
- }
- }]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement