Back Home see Bootstrap Notes
$scope.reconcile = function() { console.log("fired2.."); submitBtn = true; $http({method: 'GET', url: 'http://localhost:8090/jsonTest'}). success(function(data, status, headers, config) { // set view model or do something. console.log("sucess result " + data.bssResult); $scope.resultData = data.bssResult; submitBtn = false; }). error(function(data, status, headers, config) { console.log("failure"); submitBtn = true; }); };
If we are not using a single page application, Angular Routes can be used to route to the appropriate template
config(function ($routeProvider) { $routeProvider .when('/takenlijst', { templateUrl: 'views/takenlijst.html', controller: 'TakenlijstCtrl' }) .when('/login', { templateUrl: 'views/login.html', controller: 'LoginCtrl' }) .otherwise({ redirectTo: '/takenlijst' }); }).
'use strict'; angular.module('jfall.Controllers') .controller('LoginCtrl', function ($scope, $rootScope, $location, $http) { $scope.user = {}; $scope.login = function() { $scope.loginError = false; $http({ method: 'post', //headers: {'Content-Type': 'application/x-www-form-urlencoded'}, url: '/api/login', data: $scope.user }).success(function() { $rootScope.loggedIn = true; $location.path('/'); }).error(function() { $scope.loginError = true; }); } });