Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在另一个指令中嵌入AngularJS指令_Javascript_Angularjs_Angularjs Directive_Angular Ui_Angular Ui Typeahead - Fatal编程技术网

Javascript 在另一个指令中嵌入AngularJS指令

Javascript 在另一个指令中嵌入AngularJS指令,javascript,angularjs,angularjs-directive,angular-ui,angular-ui-typeahead,Javascript,Angularjs,Angularjs Directive,Angular Ui,Angular Ui Typeahead,我试图在一个新指令中实现一些Bootstrap类型的自定义函数。 为此,我需要将原始的Typeahed指令嵌入到我的指令中,并将其传递给我的参数: 这是原始指令: <div class="typeahead typeahead-lookup"> <input ng-model="vm.myModel" uib-typeahead="item as item.Formatted for item in vm.refreshSearch($viewV

我试图在一个新指令中实现一些Bootstrap类型的自定义函数。 为此,我需要将原始的Typeahed指令嵌入到我的指令中,并将其传递给我的参数:

这是原始指令:

<div class="typeahead typeahead-lookup">
    <input ng-model="vm.myModel" 
           uib-typeahead="item as item.Formatted for item in vm.refreshSearch($viewValue)"
           typeahead-wait-ms="1000"
           typeahead-min-length="1"
           typeahead-editable="false"
           placeholder="SEARCH..."
           type="text"
           class="form-control">
</div>
<select-lookup model="vm.myModel" 
               items="item as item.Formatted for item in vm.refreshSearch($viewValue)" 
</select-lookup>

这是我的自定义指令:

<div class="typeahead typeahead-lookup">
    <input ng-model="vm.myModel" 
           uib-typeahead="item as item.Formatted for item in vm.refreshSearch($viewValue)"
           typeahead-wait-ms="1000"
           typeahead-min-length="1"
           typeahead-editable="false"
           placeholder="SEARCH..."
           type="text"
           class="form-control">
</div>
<select-lookup model="vm.myModel" 
               items="item as item.Formatted for item in vm.refreshSearch($viewValue)" 
</select-lookup>

我会尝试
'uib-typeahead='+attrs.items+
而不是
'uib-typeahead=“{{items}}”


Typeahead正在为“for-in”语法使用自定义解析器

谢谢你,克里斯。。。我试过你的解决办法,但似乎不管用。我在这里创建了一个plunk:“for in”语法是根据指令的范围计算的,没有可用的状态。更新了plunker:如果你把指令分开怎么办<代码>模板URL:'/lib/public/angulate/views/customElements/typeahead.html',作用域:{labelText:'@',数据:'=',选择字段:'@',显示字段:'@',数组列表:'=',限制:'@',禁用:'='}和模板具有