blob: 090cb59491971d600c8fd2595edddfd660d18a6d [file] [log] [blame]
Bri Prebilic Colee0311892015-05-15 11:27:15 -07001/*
2 * Copyright 2015 Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Bri Prebilic Cole7a5431e2015-06-08 12:53:02 -070017(function () {
18 'use strict';
19
20 var urlSuffix = '/rs/logout';
21
22 angular.module('cordMast', [])
23 .controller('CordMastCtrl',
24 ['$log','$scope', '$resource', '$location', '$window',
25 function ($log, $scope, $resource, $location, $window) {
26 var LogoutData, resource;
27
28 $scope.logout = function () {
29 $log.debug('Logging out...');
30 LogoutData = $resource($scope.shared.url + urlSuffix);
31 resource = LogoutData.get({},
32 function () {
33 $location.path('/login');
34 $window.location.href = $location.absUrl();
35 $log.debug('Resource received:', resource);
36 });
37 };
38 }])
39
40 .directive('mast', function () {
41 return {
42 restrict: 'E',
43 templateUrl: 'app/fw/mast/mast.html'
44 };
45 });
46}());