0
bilalhaidar created
Hi, In one of the AppServices, I am seeing the following code generated. So which code is being called? Because I noticed that one of them uses $http and the other uses abp.ajax to perform the code.
And from debugging, I noticed the Factory is being used. But why generated the other one?
Thanks
var serviceNamespace = abp.utils.createNamespace(abp, 'services.app.personofConcern');
serviceNamespace.getPocs = function(input, ajaxParams) {
return abp.ajax($.extend({
url: abp.appPath + 'api/services/app/personofConcern/GetPocs',
type: 'POST',
data: JSON.stringify(input)
}, ajaxParams));
};
And,
(function (abp, angular) {
if (!angular) {
return;
}
var abpModule = angular.module('abp');
abpModule.factory('abp.services.app.personofConcern', [
'$http', function ($http) {
return new function () {
this.getPocs = function (input, httpParams) {
return $http(angular.extend({
url: abp.appPath + 'api/services/app/personofConcern/GetPocs',
method: 'POST',
data: JSON.stringify(input)
}, httpParams));
};
4 Answer(s)
-
0
Hi,
When you inject a service to an angular controller, $http is called. You can also use abp.services.... syntax in angularjs, in that case the jquery version is called.
-
0
Why the 2 versions to support SPA and multi-page?
-
0
Hi,
Yes, exactly that is the reason why we have two versions.
-
0
Thanks :)