Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ var app = angular.module('app', ["angucomplete"]);
| placeholder | Placeholder text for the search field | No | Search members |
| pause | The time to wait (in milliseconds) before searching when the user enters new characters | No | 400 |
| selectedObject | Where to store the selected object in your model/controller (like ng-model) | Yes | myObject |
| url | The remote URL to hit to query for results in JSON. angucomplete will automatically append the search string on the end of this, so it must be a GET request | No | http://myserver.com/api/users/find?searchstr= |
| url | The remote URL to use to query for results in JSON. By default, angucomplete will automatically append the search string on the end of this value; however, use the token {1} if the search term is in the middle of the url. The URL must be a GET request | No | http://example.com/api/users/find?searchstr=<br><br> http://example.com/api/users/find?searchstr={1}&param2=value |
| datafield | The name of the field in the JSON object returned back that holds the Array of objects to be used for the autocomplete list. | No | results |
| titlefield | The name of the field in the JSON objects returned back that should be used for displaying the title in the autocomplete list. Note, if you want to combine fields together, you can comma separate them here (e.g. for a first and last name combined) | Yes | firstName,lastName |
| descriptionfield | The name of the field in the JSON objects returned back that should be used for displaying the description in the autocomplete list | No | twitterUsername |
Expand Down
6 changes: 5 additions & 1 deletion angucomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ angular.module('angucomplete', [] )
$scope.processResults(matches, str);

} else {
$http.get($scope.url + str, {}).
var remoteUrl = $scope.url + str;
if($scope.url.indexOf("{0}") !=-1) {
remoteUrl = $scope.url.replace('{0}', str);
}
$http.get(remoteUrl, {}).
success(function(responseData, status, headers, config) {
$scope.searching = false;
$scope.processResults((($scope.dataField) ? responseData[$scope.dataField] : responseData ), str);
Expand Down