Using resource placeholders and $routeParams you define a hash URL which looks something like this <a href="#term/search+term+here">Term X</a>
. The search term can be user input or a list of terms from database
angular.module('termSearch', ['ngResource'])
.config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.headers.common["X-Requested-With"] = undefined;
}])
.config(function($routeProvider) {
$routeProvider
.when('/term/:q', {templateUrl: 'views/feedlist.html', controller: 'searchtermCtrl' })
.otherwise({redirectTo: '/term/'});
})
.factory('Feed', function ($resource) {
return $resource('https://www.example.com/:term/json', {}, {
query: {
method: 'GET',
isArray: false
}
});
})
.controller('searchtermCtrl', function($scope, Feed, $routeParams){
$scope.feed = Feed.query({ term : $routeParams.q }); // This will get the term from url
})
Now when the route changes to a new term the resource is send new data parameters