Angucomplete-alt works great for me when trying to force the user into a pre-defined selection among objects.
But if I don't want to force the user to one of those objects, if instead I want the user to be able to enter free text and only have the completions as suggestions, how then do I access the text of the input field?
For example I have a hidden field that marshals the string value of the Angucomplete-alt field for submission to the backend DB. Like this:
<input type="hidden" name="dance[start_type]"
ng-value="IS_THERE_A_SELECTION ? selectedStartType.originalObject.name : JUST_TELL_ME_THE_STRING_THEY_TYPED"/>
What expressions should I put for IS_THERE_A_SELECTION and JUST_TELL_ME_THE_STRING_THEY_TYPED?
Been banging my head against this one too. Finally just solved it but requires altering some of the angucomplete-alt source. It also uses ng-model for two way data binding.
All you need to do is add
searchStr: '=ngModel',
to the directive's internal scope. Add right after
focusIn:"&"
You now have access to ng-model in in the angucomplete-alt directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With