I have this directive:
angular.module('core.auto-complete').directive("autocompleteLigation",
[ '$http', 'LoginInfo', function($http, LoginInfo) {
return {
restrict : "A",
require : "ngModel",
link : function(scope, elem, attrs, ngModelCtrl) {
var updateModel = function(dateText) {
scope.$apply(function() {
ngModelCtrl.$setViewValue(dateText);
});
};
var parameters = {
app_id : LoginInfo.app,
type : "ligations"
};
$http({
method : 'GET',
url : 'http://localhost:8080/getAutoCompleteInfo',
params : parameters
}).then(function successCallback(response) {
var options = {
source : response.data,
select : function(event, ui) {
updateModel(ui.value);
}
};
elem.autocomplete(options);
});
}
}
} ]);
But i want to get the type value from parameters dynamically from an input text with an ng-model. In another words i want to get the autocomplition list of values based on another text input.
Edit: I Think i put low information.
<div class="form-group col-lg-4">
<label>Source table Data Base</label>
<input type="text" class="form-control"
ng-model="form.db_source"
autocomplete-databases="{{form.liga_source}}" required>
</div>
I want the value of type in the parameters to be the value passed to autocomplete-databases which is a ng-model
of another input text.