angularjs - Web Api & Angular js -
i facing problem while calling service using $http. opening .aspx page using iframe , on page load want call service written in controller $http taking full path of page , path of web api service shown below.
http://localhost:50802/tst00111cfg/app/dispatchnotify/api/dispatchnotifyservice/getworkorders
and want in below manner
http://localhost:50802/tst00111cfg/api/dispatchnotifyservice/getworkorders
my controller code
dbsrvc.getdatfromservice('api/dispatchnotifyservice/getworkorders', $scope.workorder).then(function (result) { debugger; });
please me out in this.
dnapp.service('dbsrvc', ["$http", "$q", function ($http, $q) {
var getdataservice = function (url, val) { debugger; var deferobj = $q.defer(); $http({ url: url, method: 'get', data: val }).then(function (data) { deferobj.resolve(data); }); return deferobj.promise; }; var postdataservice = function (url, val) { debugger; var deferobj = $q.defer(); $http({ url: url, method: 'post', data: val }).then(function (data) { deferobj.resolve(data); }); return deferobj.promise; }; return { getdatfromservice: getdataservice, //to data service postdatatoservice: postdataservice //to send data , retrieve service }
Comments
Post a Comment