Как включить пользовательский фильтр в код?
Это мой служебный файл.Мне нужно отфильтровать по имени.Также мне нужно предоставить проверки в html для сохранения и отмены с использованием нетронутых
app.factory('CrusdService', function($http) {
return {
fetchAll: function() {
return $http.get('https:\\localHost:5000\countries').then(
function(response) {
return response.data.data; // depends on the response data.Sometimes it will be response.data.data.data
},
function(error) {
return error;
}
);
},
add: function(data) {
return $http.post('https:\\localHost:5000\country', data).then(
function(response) {
return response;
},
function(error) {
console.log('error');
}
);
},
update: function(data) {
var name = {
"name": data.name
};
return $http.put('https:\\localHost:5000\country' + data._id, name).then(
function(response) {
return response;
},
function(error) {
console.log('error');
}
);
},
activate: function(id) {
return $http.put('https:\\localHost:5000\country' + id + '\activate').then(
function(response) {
return response;
},
function(error) {
console.log('error');
}
);
},
deactivate: function(id) {
return $http.put('https:\\localHost:5000\country' + id + '\deactivate').then(
function(response) {
return response;
},
function(error) {
console.log('error');
}
);
}
}
});