I am utilizing an HTTP resource that provides a JSON list of top 10 entities from a database by calling it in this manner:
var filter= "john";
var myApp = angular.module('myApp', []);
myApp.controller('SearchController', ['$scope','$http', function ($scope, $http) {
$http.get('/api/Entity/Find/' + filter). //Get entities filtered
success(function (data, status, headers, config) {
$scope.entities = data;
}).
error(function () {
});
}]);
This method works seamlessly!
However, I am now wondering how I can manipulate the filter
variable to modify the query. Do I need to completely overhaul the controller for this adjustment?
Update
Apologies for the unclear nature of my initial question. At the time of asking, I had limited knowledge of AngularJS.
The main goal was to inject the variable $http
without having to rely on creating a new controller solely for this purpose.
Thank you to everyone for their assistance.