最初我在发布 angular .net 核心 SPA 应用程序时遇到以下错误:
Can't resolve rxjs/operators in release\directives
我已经通过将 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.
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>**
无法理解问题
最佳答案
我找到了导致这个错误的原因,这是我以前在类(class)里的@HostListener:
@HostListener("window:resize", ["$event.target"])
onResize() {
this.getElWidth();
}
正如 Prasant Jaya 所说,抛出错误是因为我忘记在 onResize() 中添加参数。现在这是我的新代码,稍作修改并且工作正常:
@HostListener("window:resize", ["$event.target"])
onResize(event) {
this.getElWidth();
}
如果您想解决此错误,在您的类中使用 @HostListener
可能比直接在模板中监听窗口大小调整更好。
关于javascript - Angular AOT : ERROR in ng component html file : Expected 0 arguments, 但得到 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48163344/