3 Copyright 2017, Huawei Technologies Co., Ltd.
\r
5 Licensed under the Apache License, Version 2.0 (the "License");
\r
6 you may not use this file except in compliance with the License.
\r
7 You may obtain a copy of the License at
\r
9 http://www.apache.org/licenses/LICENSE-2.0
\r
11 Unless required by applicable law or agreed to in writing, software
\r
12 distributed under the License is distributed on an "AS IS" BASIS,
\r
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
14 See the License for the specific language governing permissions and
\r
15 limitations under the License.
\r
20 app.factory("provinceDataService", function($http,DataService, $log){
\r
21 var uri = 'http://192.168.9.13:18008';
\r
23 getAllProvinceData : function() {
\r
25 url: 'http://localhost:4000/api/getAllProvinceData',
\r
27 headers: {'Content-Type': 'application/json'}
\r
28 }).then(function(response){
\r
29 //$log.info(response);
\r
30 return response.data;
\r
32 return DataService.get(uri+'/api/getAllProvinceData')
\r
33 .then(function(response){
\r
34 $log.info("in get data service data is :"+response);
\r
35 console.log(response);
\r
39 addProvinceData : function(provinceDetail) {
\r
41 url: 'http://localhost:4000/api/addProvinceData',
\r
43 data: provinceDetail,
\r
44 headers: {'Content-Type': 'application/json '}
\r
45 }).then(function(response){
\r
46 console.log("Response : ");
\r
47 $log.info(response.data);
\r
48 return response.data;
\r
50 return DataService.post(uri+'/api/addProvinceData', provinceDetail)
\r
51 .then(function(response){
\r
52 console.log("Successfully added.. Data returned in DataService is");
\r
53 console.log(response);
\r
57 deleteProvinceData : function(id) {
\r
59 url: 'http://localhost:4000/api/deleteProvinceData',
\r
61 data: {'idList':idList},
\r
62 headers: {'Content-Type': 'application/json'}
\r
63 }).then(function(response){
\r
64 console.log("Successfully Deleted..");
\r
65 $log.info(response);
\r
66 return response.data;
\r
68 return DataService.delete(uri+'/api/deleteProvinceData'+"/"+id)
\r
69 .then(function(response){
\r
70 $log.info("in delete data service data is :"+response);
\r
71 console.log(response);
\r
75 editProvinceData : function(provinceDetail) {
\r
77 url: 'http://localhost:4000/api/editProvinceData',
\r
79 data: provinceDetail,
\r
80 headers: {'Content-Type': 'application/json'}
\r
81 }).then(function(response){
\r
82 console.log("Successfully Edited...");
\r
83 $log.info(response);
\r
84 return response.data;
\r
86 return DataService.put(uri+'/api/editProvinceData', provinceDetail)
\r
87 .then(function(response){
\r
88 console.log("Successfully edited.. Data returned in DataService is");
\r
89 console.log(response);
\r