You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
angular.module('topologyManager').controller('ApplicationController', function($scope,VIRLRestangular,CustomSimRestangular) { console.log("Application Controller initialized"); $scope.credentials = {username:"",password:"",token:""}; $scope.generateToken = function(){ $scope.credentials.token = btoa($scope.credentials.username+":"+$scope.credentials.password); VIRLRestangular.setDefaultHeaders({authorization: "Basic ".concat($scope.credentials.token)}); console.log($scope.credentials.token); }; $scope.verifyCredentials = function() { VIRLRestangular.one('/simengine/rest/test').get() // GET: /users
.then(function(response) { $scope.addAlert("Valid credentials","success"); }, function(response) { console.log(response); }); }; $scope.alerts = [ ]; $scope.addAlert = function(message,alertType) { $scope.alerts.push({msg: message,type:alertType}); }; $scope.closeAlert = function(index) { $scope.alerts.splice(index, 1); };
});
|