【发布时间】:2020-06-03 19:43:41
【问题描述】:
我安装了最新的 angular v8,并且我希望在运行 ng serve 时收到我在生产过程中遇到的基本模板错误。
例如
模板
<p (click)="log()">ERROR: {{ errorMessage }}</p>
控制器
log(a){}
编译错误
ERROR in apps/manufacturing-tv/src/app/app.component.ts.AppComponent.html(7,9): Expected 1 arguments, but got 0.
或
模板
<p>ERROR: {{ errorMessages }}</p>
ERROR in apps/manufacturing-tv/src/app/app.component.ts.AppComponent.html(7,25): Property 'errorMessages' does not exist on type 'AppComponent'. Did you mean 'errorMessage'?
我已经尝试添加 fullTemplateTypeCheck 标志,但运行 ng build 或 ng serve 不会产生错误。
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"types": ["jasmine"]
},
"angularCompilerOptions": {
"fullTemplateTypeCheck": true
},
"include": ["**/*.ts"]
}
【问题讨论】:
-
使用
ng build --prod的用户生产构建 -
嗨,如果有可能在开发模式下出现这些错误,那并不能回答我的问题
-
使用
ng serve --aot或ng build --aot启用提前编译
标签: angular angular-cli angular8 tsconfig ng-build