Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Angular中使用NgForm时出现编译错误_Angular_Angular Material - Fatal编程技术网

在Angular中使用NgForm时出现编译错误

在Angular中使用NgForm时出现编译错误,angular,angular-material,Angular,Angular Material,我使用双向数据绑定创建了一个相当简单的表单(到目前为止) <form #formModel="ngForm" (ngSubmit)="btnSubmitQuote(formModel)"> <mat-label>Name</mat-label> <input name="name" [(ngModel)]="formModel.name" matInput r

我使用双向数据绑定创建了一个相当简单的表单(到目前为止)

<form #formModel="ngForm" (ngSubmit)="btnSubmitQuote(formModel)">
    <mat-label>Name</mat-label>
    <input name="name" [(ngModel)]="formModel.name" matInput required>

    <div mat-dialog-actions>/
        <button type="submit"
                mat-flat-button color="primary"
                [disabled]="!formModel.form.valid">
        </button>
    </div>
</form>
我现在在运行应用程序时遇到编译错误:

Error: Error: Could not resolve [object Object] / undefined
    at Scope.resolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1323:23)
    at TcbEventHandlerTranslator.TcbExpressionTranslator.resolveTarget (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1878:35)
    at TcbEventHandlerTranslator.TcbExpressionTranslator.resolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1791:29)
    at TcbEventHandlerTranslator.resolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:2035:45)  
    at AstTranslator.maybeResolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1776:84)
    at AstTranslator.translate (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:74:33)
    at D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:201:68
    at Array.map (<anonymous>)
    at AstTranslator.visitMethodCall (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:201:33)
    at MethodCall.visit (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler\bundles\compiler.umd.js:8162:28)
[91m    at AstTranslator.translate (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:78:24)
    at Object.astToTypescript (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:55:27)
    at TcbEventHandlerTranslator.TcbExpressionTranslator.translate (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1776:33)
    at tcbEventHandlerExpression (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:2017:27)
    at tcbCreateEventHandler (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1975:23)
    at TcbUnclaimedOutputsOp.execute (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1069:39) 
错误:错误:无法解析[对象]/未定义
在Scope.resolve(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1323:23)
在TcbEventHandlerTranslator.tcbeexpressiontranslator.resolveTarget(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1878:35)
在TcbEventHandlerTranslator.tcbeexpressiontranslator.resolve(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1791:29)
在TcbEventHandlerTranslator.resolve(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:2035:45)
在AstTranslator.maybeResolve(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1776:84)
在AstTranslator.translate(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\expression.js:74:33)
位于D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\expression.js:201:68
在Array.map()处
在AstTranslator.visitMethodCall(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\expression.js:201:33)
在MethodCall.visit(D:\Documents\Code\Github\neis-guy-painting angular\neis-guy-painting\node\u-modules\@angular\compiler\bundles\compiler.umd.js:8162:28)
[91m at AstTranslator.translate(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\expression.js:78:24)
在Object.astToTypescript(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\expression.js:55:27)
在TcbEventHandlerTranslator.tcbeexpressiontranslator.translate(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1776:33)
在tcbEventHandlerExpression(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:2017:27)
在tcbCreateEventHandler(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1975:23)
在TcbUnclaimedOutputsOp.execute(D:\Documents\Code\Github\neis guy painting angular\neis guy painting\node\u modules\@angular\compiler cli\src\ngtsc\typecheck\src\type\u check\u block.js:1069:39)
第一行,
,似乎是导致错误的原因

这可能是棱角材料的问题吗?我在安装时遇到了一些问题,但我可以确认我的安装正常,因为我可以创建一个带有
Start
的按钮


如果需要,我可以提供更多信息。

您能否将其添加到stackblitz中,以帮助您在TS formModel中定义为@ViewChild('formModel')formModel:NgForm?
Error: Error: Could not resolve [object Object] / undefined
    at Scope.resolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1323:23)
    at TcbEventHandlerTranslator.TcbExpressionTranslator.resolveTarget (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1878:35)
    at TcbEventHandlerTranslator.TcbExpressionTranslator.resolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1791:29)
    at TcbEventHandlerTranslator.resolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:2035:45)  
    at AstTranslator.maybeResolve (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1776:84)
    at AstTranslator.translate (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:74:33)
    at D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:201:68
    at Array.map (<anonymous>)
    at AstTranslator.visitMethodCall (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:201:33)
    at MethodCall.visit (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler\bundles\compiler.umd.js:8162:28)
[91m    at AstTranslator.translate (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:78:24)
    at Object.astToTypescript (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\expression.js:55:27)
    at TcbEventHandlerTranslator.TcbExpressionTranslator.translate (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1776:33)
    at tcbEventHandlerExpression (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:2017:27)
    at tcbCreateEventHandler (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1975:23)
    at TcbUnclaimedOutputsOp.execute (D:\Documents\Code\Github\neis-guy-painting-angular\neis-guy-painting\node_modules\@angular\compiler-cli\src\ngtsc\typecheck\src\type_check_block.js:1069:39)