My data consists of code:description pairs (e.g. cmsc100: Web Programming). I have a search box where users can enter either the code or description. Upon clicking the button, the program should display the data that matches the entered code/description or show "Nothing found" if it's not in the dataset.
The API has been verified to be accurate. However, I'm having trouble implementing it in Angular. Whenever I click the button, it keeps returning "0 results found".
This is my Controller:
//search by description
$scope.byDescription = function(){
$http
.get('http://localhost:3000/api/search-by-desc')
.then(function(response){
$scope.subjects = response.data;
console.log(response);
},
function(response){
console.log(response);
$scope.subjects = 'Nothing found';
});
$scope.desc = "";
}