Here is the HTML code I am working with:
<div class='container-fluid' ng-controller="TypeaheadCtrl">
<p></p>
<b>Selected User</b>
Enter a name: <input type="text" ng-model="selected" typeahead="user as (user.first + ' ' + user.last) for user in users | filter:$viewValue" />
</div>
This is the controller being used:
app.controller('TypeaheadCtrl', ['$scope', 'getUser',function($scope, getUser) {
$scope.selected = "";
getUser.success(function(data) {
$scope.users = data;
});
}]);
And here is the service implemented:
app.factory('getUser', ['$http', function($http) {
return $http.get('https://myUrl?param=Foo')
.success(function(data) {
return data;
})
.error(function(err) {
return err;
});
}]);
I am wondering how I can pass an argument to the service to make the value of param
in the URL dynamic.