Aurelia 没有绑定可绑定属性的自定义属性
也许有人能帮我 我似乎无法将回调绑定到customAttribute。 这里有一些代码Aurelia 没有绑定可绑定属性的自定义属性,aurelia,Aurelia,也许有人能帮我 我似乎无法将回调绑定到customAttribute。 这里有一些代码 import {inject, customAttribute, bindable} from 'aurelia-framework'; import 'typeahead'; @customAttribute('typeahead') @inject(Element) export class Typeahead { @bindable minLength = 0; @bindable h
import {inject, customAttribute, bindable} from 'aurelia-framework';
import 'typeahead';
@customAttribute('typeahead')
@inject(Element)
export class Typeahead {
@bindable minLength = 0;
@bindable highlight = true;
@bindable substringMatcher = null;
constructor(element) {
this.element = element;
}
attached() {
var self = this;
$(self.element).typeahead({
hint: true,
highlight: self.highlight,
minLength: self.minLength
},
{
name: 'query',
source: (query) =>
{
console.log(self.substringMatcher);
if(self.substringMatcher){
self.substringMatcher(query);
}
}
});
}
}
我一直在尝试以多种方式分配substringMatcher bindable回调,但该属性始终为null
<input typeahead="substringMatcher.bind: search" class="form-control typeahead">
<input typeahead="substringMatcher: search" class="form-control typeahead">
<input typeahead="substringMatcher: this.search" class="form-control typeahead">
知道为什么吗?属性的大小写错误 这起到了作用: