我正在使用离子框架构建一个应用程序,在我的搜索模块中,我正在使用一个名为ion-autocomplete explained in the doc的库,试图将ng-model绑定到我的范围但是我无法将它绑定。
控制器:
//this derective is an input field
<ion-autocomplete ng-model="model" items-method="callbackMethod(query)" placeholder="Enter something"/>
查看:
var template = '<input type="search" class="ion-autocomplete-search" ng-model="searchQuery" placeholder="{{placeholder}}"/>'
模板:
.directive('ionAutocomplete', function () {
return {
require: '?ngModel',
restrict: 'E',
template: '<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete" autocomplete="off" />',
replace: true
}
});
指令:
{{1}}