angular2 TypeError: self._el_11 is not a function
angular2 TypeError: self._el_11 is not a function
我想为输入添加事件侦听器,这是我的代码
<input ref-search (keyup)="search(search.value)">
搜索方法是
search(condition: string){
console.log(condition);
}
然后当我输入一些东西时,浏览器控制台日志是
TypeError: self._el_11 is not a function
at AppView._View_YwCoffeeListComponent0._handle_click_11_0 (YwCoffeeListComponent.ngfactory.js:217)
at platform-browser.umd.js:1854
at platform-browser.umd.js:1967
at ZoneDelegate.invoke (zone.js:192)
at Object.NgZoneImpl.inner.inner.fork.onInvoke (core.umd.js:8772)
at ZoneDelegate.invoke (zone.js:191)
at Zone.runGuarded (zone.js:99)
at NgZoneImpl.runInnerGuarded (core.umd.js:8805)
at NgZone.runGuarded (core.umd.js:9038)
at HTMLInputElement.i (platform-browser.umd.js:1967)
和YwCoffeeListComponent.ngfactory.js:217代码是
_View_YwCoffeeListComponent0.prototype._handle_click_11_0 = function($event) {var self = this;self.markPathToRootAsCheckOnce();var pd_0 = (self._el_11(self._el_11.value) !== false);return (true && pd_0);};
那是因为您定义了与您的方法同名的模板引用变量。
因此将其更改为:
<input ref-searchInput (keyup)="search(searchInput.value)">
我想为输入添加事件侦听器,这是我的代码
<input ref-search (keyup)="search(search.value)">
搜索方法是
search(condition: string){
console.log(condition);
}
然后当我输入一些东西时,浏览器控制台日志是
TypeError: self._el_11 is not a function
at AppView._View_YwCoffeeListComponent0._handle_click_11_0 (YwCoffeeListComponent.ngfactory.js:217)
at platform-browser.umd.js:1854
at platform-browser.umd.js:1967
at ZoneDelegate.invoke (zone.js:192)
at Object.NgZoneImpl.inner.inner.fork.onInvoke (core.umd.js:8772)
at ZoneDelegate.invoke (zone.js:191)
at Zone.runGuarded (zone.js:99)
at NgZoneImpl.runInnerGuarded (core.umd.js:8805)
at NgZone.runGuarded (core.umd.js:9038)
at HTMLInputElement.i (platform-browser.umd.js:1967)
和YwCoffeeListComponent.ngfactory.js:217代码是
_View_YwCoffeeListComponent0.prototype._handle_click_11_0 = function($event) {var self = this;self.markPathToRootAsCheckOnce();var pd_0 = (self._el_11(self._el_11.value) !== false);return (true && pd_0);};
那是因为您定义了与您的方法同名的模板引用变量。
因此将其更改为:
<input ref-searchInput (keyup)="search(searchInput.value)">