0
Hello, I have two functions that work separately very good, but I need to combine them now to organize the result of the other. Function of Organs:
$scope.$watch('organ_id', function (newValue, oldValue) {
if (newValue != null && newValue != '') {
$scope.servicesPromise =
$http
.get('/api/services.json?organ_id=' + newValue)
.success(function (data) {
$scope.total_pages = data.total_pages;
$scope.services = data.services;
});
};
}, true);
Function by letters
$scope.byLetter = function (letter) {
$scope.servicesPromise =
$http
.get('/api/services.json?letter=' + letter)
.success(function (data) {
$scope.total_pages = data.total_pages;
$scope.services = data.services;
$scope.tama_letra = data.tam_letter;
});
};
The function of organs behind a set and what I wish is that when I select the order by letters the return is only the services of that given organ with that letter.
for example: Whether I chose organ X; I have as return SX services; in this set I want to know which services that initial with the letter E; I choose the letter E; I need the answer, in this case are the SX that start with E.
Your service accepts the two combined parameters?
– Sorack
Yes, the function accepts!
– Carlos André
So it wouldn’t just be making a call with the two parameters?
– Sorack
Just, in the combination I imagine, the parameters would be (organ_id, Letter).
– Carlos André
All right, I’ll write a response based on that then
– Sorack