49 lines
1.4 KiB
JavaScript
49 lines
1.4 KiB
JavaScript
var arr = window.location.href.split("/");
|
|
if (arr[3].indexOf('app') == 0)
|
|
baseUrl = '';
|
|
else
|
|
baseUrl = '/' + arr[3];
|
|
angular.module('CarbonFootprint')
|
|
.config(function ($routeProvider) {
|
|
$routeProvider.when('/Fab/Index', {
|
|
templateUrl: baseUrl+'/Partials/Fab-Index',
|
|
controller: 'FabController'
|
|
});
|
|
})
|
|
|
|
.controller('FabController', [
|
|
'$scope', '$http', '$location',
|
|
function ($scope, $http, $location) {
|
|
|
|
// set $scope.baseUrl
|
|
var baseUrl = $scope.baseUrl;
|
|
if (typeof (baseUrl) === 'undefined' || baseUrl == null) {
|
|
var arr = window.location.href.split("/");
|
|
if (arr[3].indexOf('app') == 0)
|
|
baseUrl = '';
|
|
else
|
|
baseUrl = '/' + arr[3];
|
|
$scope.baseUrl = baseUrl;
|
|
}
|
|
|
|
$scope.redirectToCreatePage = function () {
|
|
$location.path('/Fab/Create');
|
|
};
|
|
|
|
$scope.redirectToEditPage = function (fabId) {
|
|
$location.path('/Fab/Edit/' + fabId);
|
|
};
|
|
|
|
$http.get($scope.baseUrl+'/api/Fab/GetAll2')
|
|
.success(function (data, status, headers, config) {
|
|
//console.log(data);
|
|
$scope.fabList = data.fabs;
|
|
$scope.insynerger = data.insynerger;
|
|
sessionStorage.setItem("insynerger", data.insynerger);
|
|
//console.log('insynerger', sessionStorage.getItem("insynerger"));
|
|
})
|
|
.error(function (data, status) {
|
|
console.log(status);
|
|
});
|
|
}
|
|
]); |