javascript - redefine ng-model using ng-if -
Then I have a kind of forward that users can choose options after typing in the form if search data exists , Then the details of the data are automatically filled in text, however, if search data is not present, the details box is automatically filled with search data, which is what I do not want because it is an empty string, because it exists Not in.
& lt; Input type = "text" required class = "formahead-regulated =" incorrect as treatment.service for treating "form control form control model" ng model = "newTreatment.async_selected_treatment" typeahead = "treatment searchTreatments ($ viewValue) "Type-based-selection =" search treatment ($ item) "focus =" true "placeholder =" CPT code "& gt; & Lt; Text area class = "form control required form control modal" rows = "3" ng-if = "newTreatment.async_selected_treatment.id == 'null'" ng model = "newTreatment.async_selected_treatment.description" placeholder = "add a description" & Gt; & Lt; / Textarea & gt; I wrote NG-but it was not intended. I basically need to check, then
newTreatment.async_selected_treatment.id is null (because it does not exist in backend) Then I need
newTreatment.async_selected_treatment.description to return nothing
Reflections I'm open to other Paintings Tips / Suggestions
to deal with this issue
do not work
You can set Typeahead editable = "wrong" and ng-stigma instructions please see here add:
HTML:
Model: {{selected | Json}} & lt; Input type = "text" typeahead editable = "false" ng-blur = "clear ()" ng model = "selected" typeahead = "state state for state | filter: $ view value | limitTo: 8" class = "Form-control" & gt; JS:
$ scope.clear = function () {
if ($ scope.selected === undefined) {$ Scope.selected = ''; }
Comments
Post a Comment