1 define([], function () {
4 angular.module('app.gbp').service('ContractListService', ContractListService);
6 ContractListService.$inject = ['Restangular', 'ContractService'];
8 function ContractListService(Restangular, ContractService) {
10 this.createList = createList;
12 function ContractList() {
16 this.setData = setData;
21 * fills ContractList object with data
24 function setData(data) {
26 data.forEach(function (dataElement) {
27 self.data.push(ContractService.createObject(dataElement));
31 function get(dataStore) {
32 /* jshint validthis:true */
35 var restObj = Restangular.one('restconf').one(dataStore).one('policy:tenants')
36 .one('tenant').one('tenant1').one('policy');
38 return restObj.get().then(function (data) {
39 if (data.policy.contract) {
40 self.setData(data.policy.contract);
46 function createList() {
47 var obj = new ContractList();
53 return ContractListService;