javascript - Selecting options in angular-ui type ahead has no effect -
here html markup:
<script type="text/ng-template" id="typeaheadtemplate.html"> <span bind-html-unsafe="match.model.project_desc | typeaheadhighlight:query"></span> </script> <div ng-show="commentmain.commenttype == 'project'" id="commentprojectother" class="btn-group animate-slide-vertical" style="margin-bottom: 7px; margin-left: 7px;"> <input type="text" ng-model="commentmain.project" placeholder="select name of project" typeahead-on-select="commentmain.comment.project_id = $model.project_id || null" typeahead="project projects in commentmain.getprojects($viewvalue)" typeahead-loading="loadingprojects" typeahead-template-url="typeaheadtemplate.html" class="form-control" /> </div>
projects coming [{project_desc: 'blah', project_id: 1, ...other params}, etc.]
the api being accessed , options being populated type-ahead.
however, type ahead not letting me select of options. mean when hover on options, not turn blue , when select option not populate model (or type ahead textbox).
i think not turn blue because used own template typeahead, if want show project description in typeahead remove typeahead-template-url
, change typeahead attribute to:
typeahead="project project.project_desc projects in commentmain.getprojects($viewvalue)"
and on-select wrong too, should be:
typeahead-on-select="commentmain.comment.project_id = commentmain.project.project_id"
because defined commentmain.project
model , when select 1 project populated!
Comments
Post a Comment