Hello, I have two functions that work separately very well, but I need to combine them now to organize the result of the other. Organs Function:
$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 brings a set and what I want is that when I select the order by letters the return is only the services of that given organ with that letter.
For example: If I chose organ X; I have returned SX services; in this set I want to know what services I initial with the letter E; I choose the letter E; I need the answer, in this case, the SX starting with E.