Я использую эту услугу, чтобы получить данные json. Как я могу передать два параметра. С json мне нужно заполнить выпадающее меню.Параметры углового прохода и прием json
myApp.service('allCurrentSettingsService', ['$http', '$q', function ($http, $q) {
var allSettings = null;
this.getList = function() {
var def = $q.defer()
if (allSettings) {
def.resolve(allSettings);
} else {
$http.post('GetAllCurrentSettings', { companyName: compName, customerName: custName })
.then(function (response) {
var response = $.parseJSON(response.data)
allSettings = response;
def.resolve(allSettings);
});
}
return def.promise;
}
}]);
И вот я звоню службу:
myApp.controller('myController', ['$scope', 'getDocTypesService',
function ($scope, getDocTypesService) {
$scope.getDocTypes = '';
getDocTypesService.getList(compName, custName).then(function (value) {
$scope.getDocTypes = value
});
}
]);
Где бы вы хотели добавить параметры? Запрос? Url params? тело? – mfrachet
- это два параметра, идущих от углового к вашему обслуживанию или от вашего обслуживания до углового? – Manatax
Спасибо. Параметры идут от углового обслуживания к моему контроллеру mvc. – user6440175