Skip to content

Commit

Permalink
Merge pull request darylrowland#113 from jermspeaks/master
Browse files Browse the repository at this point in the history
Added an attribute that could allow the use of 'withCredentials' for the http call
  • Loading branch information
ghiden committed Feb 15, 2015
2 parents 5b77407 + 64a66c6 commit 4c42540
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ var app = angular.module('app', ["angucomplete-alt"]);
| local-data | The local data variable to use from your controller. Should be an array of objects. [example](http://ghiden.github.io/angucomplete-alt/#example1) | No | countriesList |
| search-fields | The fields from your local data to search on (comma separate them). Each field can contain dots for accessing nested attribute. [example](http://ghiden.github.io/angucomplete-alt/#example1) | No | title,description |
| remote-url-request-formatter | A function that takes a query string and returns parameter(s) for GET. It should take the query string as argument and returns a key-value object. [example](http://ghiden.github.io/angucomplete-alt/#example5) | No | Suppose if you need to send a query keyword and a timestamp to search API, you can write a function like this in the parent scope. $scope.dataFormatFn = function(str) { return {q: str, timestamp: +new Date()}; } |
| remote-url-request-with-credentials | A boolean that accepts parameters with credentials. | No | true or false |
| remote-url-response-formatter | A function on the scope that will modify raw response from remote API before it is rendered in the drop-down. Useful for adding data that may not be available from the API. The specified function must return the object in the format that angucomplete understands. | No | addImageUrlToObject |
| remote-url-error-callback | A callback funciton to handle error response from $http.get | No | httpErrorCallbackFn |
| clear-selected | To clear out input field upon selecting an item, set this attribute to true. [example](http://ghiden.github.io/angucomplete-alt/#example3) | No | true |
Expand Down
4 changes: 4 additions & 0 deletions angucomplete-alt.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
initialValue: '@',
localData: '=',
remoteUrlRequestFormatter: '=',
remoteUrlRequestWithCredentials: '@',
remoteUrlResponseFormatter: '=',
remoteUrlErrorCallback: '=',
id: '@',
Expand Down Expand Up @@ -427,6 +428,9 @@
params = {params: scope.remoteUrlRequestFormatter(str)};
url = scope.remoteUrl;
}
if (!!scope.remoteUrlRequestWithCredentials) {
params.withCredentials = true;
}
cancelHttpRequest();
httpCanceller = $q.defer();
params.timeout = httpCanceller.promise;
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angucomplete-alt",
"version": "0.0.36",
"version": "0.0.37",
"homepage": "http://ghiden.github.io/angucomplete-alt/",
"authors": [
"Hidenari Nozaki <[email protected]>"
Expand Down

0 comments on commit 4c42540

Please sign in to comment.