angularjs - access controller scope from Bootstrap-UI Typeahead template -
i unable call controller function inside custom-template ui-typeahead:
<input typeahead="val val in autocomplete($viewvalue)" typeahead-template-url="searchautocompletetpl.html" ng-model="query"/> <script type="text/ng-template" id="searchautocompletetpl.html"> <span ng-repeat="eqp in match.model.equipment"/> <a href="" ng-click="showitem(eqp.model)"> found in: {{eqp.model}} </a> </script>
the problem controller's scope seems absent in template:
showitem(eqp.model)
is never called. have tried with:
$parent.showitem(eqp.model)
to no avail.
how can call function/value on controller's scope then?
i ran same problem , had @ typeahead code on github see if might offer clues. appears there several directives involved in creation of suggestions list , each gets own child scope.
in other words, $parent.showitem(eqp.model)
attempt, didn't go enough levels. worked me was: $parent.$parent.$parent.showitem(eqp.model)
Comments
Post a Comment