Angular typeahead, install custom popup template

Anyway to install a custom template for typeahead-popup?

The typeahead-template-url directive is only for every popup match.

here is my code:

    <input class="select-location" id="Location" type="text"
 ng-model="model.location" 
 ng-keypress="keypress($event)"
 typeahead="match for match in getLocations($viewValue)"
 typeahead-template-url="matchUrl"/>
+4
source share
1 answer

You can use AngularJS decoders, which allow you to change directives (also services and almost everything) while they are being created.

This is the version of the monkey fix in AngularJS format. In the future, if you want to change other directives, the template is used when using the method .decorator.

[nameOfDirective]Directive eg: typeaheadPopupDirective

var app = angular.module("monkey", ["ui.bootstrap"]);
app.config(function ($provide) {
    $provide.decorator("typeaheadPopupDirective", function ($delegate) {
        $delegate[0].templateUrl = "template/typeahead/typeahead-popup-ALTERNATIVE.html";
        return $delegate;
    });
});

ui-bootstrap. 404, URL .

http://plnkr.co/edit/0mPADZ7D7Eszp07R2g60?p=preview


.

, . , , , .

angular bootstrap 0.14.x, . typeahead , , typeahead-popup-template-url.

<input type="text" ng-model="selected"
     typeahead="state for state in states | filter:$viewValue
     typeahead-append-to-body="true"
     typeahead-popup-template-url="customPopUp.html"
     class="form-control">
+4

All Articles