passing parameters to $resource in angularjs.
I have a search button in the UI upon clicking which I want to pass the input parameter to the $resource which would call the REST service in the backend.
when I pass a string value in the .query it works perfectly fine, but the @issueinput is not getting resolved to the input value.
this is the app.js
var myApp = angular.module('myApp',['ui.router', 'ngResource']);
myApp.factory('SearchService',function($resource){
return $resource("http://localhost:8081/support/api/search/:issuename");
});
this is the controller
angular
.module('myApp')
.controller('searchCtrl',['$scope', '$window','SearchService', function($scope, $window, SearchService){
$scope.data={};
$scope.search = function(issueinput){
SearchService.query({issuename:'@issueinput'},function(response){
$scope.data.issues = response;
});
};
}
]);
this is the UI html
<html>
<div id="searchpage">
<label>Search</label> :<input data-ng-model="issueinput"></input> {{issueinput}}
<br/>
<br/>
<br/>
<button data-ng-click="search(issueinput)">Search</button>
<br/>
<br/>
<ul>
<li data-ng-repeat="s in data.issues">{{s.issueName}} : {{s.issueDescription}}</li>
</ul>
</div>
</html>