Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.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 未处理的承诺拒绝:模板分析错误_Angular_Typescript - Fatal编程技术网

Angular 未处理的承诺拒绝:模板分析错误

Angular 未处理的承诺拒绝:模板分析错误,angular,typescript,Angular,Typescript,虽然我已将AuthComponent添加到AuthModule中,但我收到了以下错误: Unhandled Promise rejection: Template parse errors: 'auth' is not a known element: 1. If 'auth' is an Angular component, then verify that it is part of this module. 2. To allow any element add 'NO_ERRORS_SC

虽然我已将
AuthComponent
添加到
AuthModule
中,但我收到了以下错误:

Unhandled Promise rejection: Template parse errors:
'auth' is not a known element:
1. If 'auth' is an Angular component, then verify that it is part of this module.
2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("ystem.import('public/app/auth').catch(function (err) { console.error(err); });</script></head><body>[ERROR ->]<auth><div class="progress-container"><div class="progress"><div class="indeterminate"></div></div></"): ng:///success-snackBar.component@0:861 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:
登入表格:

<head>
    <script src='systemjs.config.js'></script>
    <script> 
        System.import('public/app/auth').catch(function (err) { console.error(err); })
    </script>
</head>
<body>
    <auth></auth> // the selector is used here and the error comes from here
</body>
更新:

像这样引导AuthModule

import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AuthModule} from "./auth.module";

platformBrowserDynamic().bootstrapModule(AuthModule);

任何帮助都将不胜感激。

您是否引导了AuthModule
?另外,
templateUrl:'/auth.component'
听起来不像
templateUrl
,它应该是
/auth.component.html'
(.thml扩展名)是的,我启动了
AuthModule
,更新了我的帖子。
import {NgModule} from "@angular/core";
import {CommonModule} from "@angular/common";
import {FormsModule} from "@angular/forms";
import {BrowserModule} from "@angular/platform-browser";
import {LoginModule} from "./login/login.module";
import {AuthService} from "./auth.service";
import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
import {AuthComponent} from "./auth/auth.component";
import {HttpClientModule} from "@angular/common/http";

@NgModule({
    imports: [
        BrowserModule,
        CommonModule,
        BrowserAnimationsModule,
        FormsModule,
        LoginModule,
        HttpClientModule
    ],
    declarations: [
        AuthComponent
    ],
    providers: [
        AuthService
    ],
    exports: [
        AuthComponent
    ],
    bootstrap: [AuthComponent]
})
export class AuthModule {
}
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {AuthModule} from "./auth.module";

platformBrowserDynamic().bootstrapModule(AuthModule);