how do i encode the keyword that get sent to the server and then decode it?
I can't search for keywords containing chars like .? or / at the moment.
The code displaying is wrong because endpoint returns a object.
self.search = function (keyword) {
var endpoint = $location.path(baseEndpoint + "search/").search(keyword),
deferred = $q.defer();
$http.get(HttpRequestUrlHelper.ensureUniqueRequestUrl(endpoint), {
}).success(function (response) {
deferred.resolve(response);
}).error(function (error) {
deferred.reject(error);
});
return deferred.promise;
}
If i use encodeURIComponent() my url is encoded but my controller isn't hit:
request url => /todo/search/Leka%20med%20barnen.?UniqueKey=1404655031784 angular.js:9159
GET http://localhost:49195/todo/search/Leka%20med%20barnen.?UniqueKey=1404655031784 404 (Not Found)
Ended up making a query string instead:
var endpoint = baseEndpoint + "search?keyword=" + keyword,