Sag*_*r K 5 javascript jquery typescript angular2-aot angular
最初我在发布angular .net core SPA App时遇到以下错误:
无法在release\directives中解析rxjs /运算符
我已经通过将rxjs版本更新为5.6来解决了这个问题.
现在,在发布应用程序时,我遇到以下错误:
WARNING in EnvironmentPlugin - NODE_ENV environment variable is undefined.
You can pass an object with default values to suppress this warning.
See https://webpack.js.org/plugins/environment-plugin for example.
ERROR in ng:///D:/ClientApp/app/components/search/search.component.html (15,91): Expected 0 arguments, but got 1.
ERROR in ng:///D:/ClientApp/app/components/search/search.component.html (134,32): Expected 0 arguments, but got 1.
ERROR in ng:///D:/ClientApp/app/components/search/search.component.html (278,25): Expected 1 arguments, but got 0.
ERROR in ng:///D:/ClientApp/app/components/search/search.component.html (15,91): Expected 0 arguments, but got 1.
ERROR in ng:///D:/ClientApp/app/components/search/search.component.html (134,32): Expected 0 arguments, but got 1.
ERROR in ng:///D:/ClientApp/app/components/search/search.component.html (278,25): Expected 1 arguments, but got 0.
Run Code Online (Sandbox Code Playgroud)
Search.Component.html文件:
<div class="search">
<div class='panel panel-primary'>
<div class='panel-heading resultbar'>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<span class=' navbar-toggle collapsed glyphicon glyphicon-menu-hamburger' (window:resize)="onZoomIn($event)" (click)="toggleHeader()" style="cursor: pointer;" placement="top"></span>
**</div>**
Run Code Online (Sandbox Code Playgroud)
无法理解这个问题
我找到了导致此错误的原因,这是我班级中以前的@HostListener:
@HostListener("window:resize", ["$event.target"])
onResize() {
this.getElWidth();
}
Run Code Online (Sandbox Code Playgroud)
正如 Prasant Jaya 所说,抛出错误是因为我忘记在 onResize() 中放置一个参数。现在这是我的新代码稍加修改并且工作正常:
@HostListener("window:resize", ["$event.target"])
onResize(event) {
this.getElWidth();
}
Run Code Online (Sandbox Code Playgroud)
@HostListener如果您想解决此错误,在您的班级中使用可能比直接在模板中收听窗口大小调整更好。
如果从组件中的视图调用函数而没有参数或参数较少,则会发生此错误.组件函数调用应具有与函数中声明的参数数量相同的参数.
如果仍然遇到相同的错误,请尝试添加any参数,它接受任何类型的值.
onZoomIn(event : any){
console.log(event);
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3138 次 |
| 最近记录: |