【问题标题】:Simple angular ment.io menu not working简单的 angular ment.io 菜单不起作用
【发布时间】:2016-04-03 21:33:18
【问题描述】:

标记

<input type="text" 
   mentio
   mentio-id="'test'"
   mentio-typed-text="typedTerm"
   ng-model="myval"/>

<mentio-menu
    mentio-for="'test'"
    mentio-trigger-char="'@'"
    mentio-items="mentioPeople"
    ></mentio-menu>

内部控制器:

module.controller($scope) {
    $scope.mentioPeople = [{label: "Test"}];
}

上面的代码不起作用(当我输入'@'字符时没有任何反应)。

如果我在输入元素中嵌入与属性指令相同的选项,它会起作用 - 请参阅以下内容:

<input type="text" mentio
   mentio-id="'test'"
   mentio-typed-text="typedTerm"
   mentio-trigger-char="'@'"
   mentio-items="mentioPeople"
   ng-model="myval"/>

为什么?在第一个示例中我做错了什么?

【问题讨论】:

    标签: javascript angularjs mention


    【解决方案1】:

    事实证明mentio-search 选项是强制性的。以下

    <mentio-menu
        mentio-for="'test'"
        mentio-trigger-char="'@'"
        mentio-items="mentioPeople"
        mentio-search="search()"
            ></mentio-menu>
    

    会起作用。

    感谢 ronaldheft here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-09-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-06
      • 2014-11-30
      相关资源
      最近更新 更多