Angular - uib-typeahead使用单独的ng-click选项为每个列表项添加图标

时间:2017-06-12 06:55:11

标签: javascript angularjs angular-ui-typeahead

我有一个uib-typeahead,我有项目列表。我想为用户提供添加特定值作为收藏的选项,我需要在每个列表项目前面显示一个星形图标。

我需要这样的东西。

enter image description here

如何通过添加收藏夹的选项来实现这样的uib-typeahead列表。

只有在点击星形图标时,我才会调用api添加为收藏夹,如果点击该名称,则只会选择该值。

我目前通过在用户点击选项询问是否需要添加为收藏夹时弹出窗口来完成此操作。

修改:

<input id="catg" type="text" placeholder="Enter Text / Select" ng-model="addTolist" class="form-control" uib-typeahead="template as template.content for template in getTemplate($viewValue) | limitTo:8" typeahead-on-select="onSelect($viewValue)" typeahead-min-length="0" >


$scope.onSelect= function(value){
    var options = {
        title: '<b>Add as Favourite</b>',
        message:'',
        templateUrl: 'views/addFavourite.htm',
         size:'small',
         onEscape: true,
        buttons: {
            ok:{
                 label: " Enable",
                 className: "btn-primary fa fa-save",
                callback: function() {

             }
         }
}
$ngBootbox.customDialog(options);

};

在回调中,我将api称为添加为收藏

0 个答案:

没有答案
相关问题