Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.
This repository was archived by the owner on May 29, 2019. It is now read-only.

Custom typeahead template with ng-clicks #499

@i8ramin

Description

@i8ramin

Hi. I am using the typeahead module and have my own custom template. my template has a few actions in it that I would like to tie to functions in my controller. I haven't been able to figure out how to do this, since it seems like the results popup has its own scope.

Here is my templates:

<ul class="typeahead dropdown-menu" ng-style="{display: isOpen()&&'block' || 'none', top: position.top+'px', left: position.left+'px'}">
  <li ng-repeat="match in matches" ng-class="{active: isActive($index)}" ng-mouseenter="selectActive($index)" class="suggestion">
    <div class="media member-card">
      <div class="bd">
        <div class="info">
          <div class="name" ng-bind-html-unsafe="match.model.name | typeaheadHighlight:query"></div>
          <div class="company">{{match.model.company}}</div>
          <div class="contact">
            <span class="phone">{{match.model.phone}}</span>
          </div>
        </div>

        <div class="actions">
          <a class="action package" ng-click="notifyPackage()">Package</a>
          <a href="#guest" class="action guest" ng-click="notifyGuest()">Guest</a>
          <a href="#food" class="action food" ng-click="notifyFood()">Food</a>
        </div>
      </div>
    </div>
  </li>
</ul>

I would like to tie in some functionality to those "actions" towards the bottom. i.e. ng-click="notifyPackage()". Where would I put this function? How do I access the scope of my SearchCtrl from this template view so that I can do this correctly.

Also, any way to disable the default "reset" of the results when you click on the document?

Thank you,
Ramin

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions