SmartIT_Extensions/BMC/smart-it-full-helix/scripts/app/common/url-creator-service.js

21 lines
675 B
JavaScript

"use strict";
/**
* Created by viktor.shevchenko on 7/30/2014.
*/
(function () {
'use strict';
angular.module('myitsmApp')
.service('urlCreatorService', ['$location', function ($location) {
this.create = function (entity) {
var url = $location.absUrl().replace($location.url(), '/');
if (entity.ticketType === EntityVO.TYPE_ASSET) {
url += entity.ticketType + '/' + entity.reconciliationId + '/' + entity.classId;
}
else {
url += entity.type + '/' + entity.id;
}
return url;
};
}]);
}());