Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.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
Node.js 分析模板时出错:意外关闭标记应用程序帖子列表_Node.js_Angular_Mean - Fatal编程技术网

Node.js 分析模板时出错:意外关闭标记应用程序帖子列表

Node.js 分析模板时出错:意外关闭标记应用程序帖子列表,node.js,angular,mean,Node.js,Angular,Mean,当我试图以角度输出帖子时出错。请帮助解决此问题 错误消息 import { Component } from "@angular/core"; @Component({ selector: 'aap-post-list', templateUrl: './post-list.component.html' }) export class PostListComponent {} <app-header></app-header> <main> <

当我试图以角度输出帖子时出错。请帮助解决此问题

错误消息

import { Component } from "@angular/core";

@Component({
selector: 'aap-post-list',
templateUrl: './post-list.component.html'
})

export class PostListComponent {}
<app-header></app-header>
<main>
  <app-post-create></app-post-create>
  <aap-post-list></app-post-list>
</main>
分析模板时出错:意外的结束标记“应用程序帖子列表”

我的post-list.component.ts代码

import { Component } from "@angular/core";

@Component({
selector: 'aap-post-list',
templateUrl: './post-list.component.html'
})

export class PostListComponent {}
<app-header></app-header>
<main>
  <app-post-create></app-post-create>
  <aap-post-list></app-post-list>
</main>
我的帖子列表.component.html

<mat-accordion>
   <mat-expansion-panel>
    <mat-expansion-panel-header>
      The expansion title!
    </mat-expansion-panel-header>
    <p>I'm in an expansion panel!</p>
   </mat-expansion-panel>
</mat-accordion>
应用组件规范ts

import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatInputModule} from '@angular/material/input';
import { MatCardModule} from '@angular/material/card';
import { MatButtonModule } from '@angular/material/button';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatExpansionModule } from '@angular/material/expansion';
import { AppComponent } from './app.component';
import {PostCreateComponent} from './posts/post-create/post-create.component';
import { HeaderComponent } from './header/header.component';
import { PostListComponent } from './posts/post-list/post-list.component';
import { from } from 'rxjs';

@NgModule({
declarations: [
AppComponent,
PostCreateComponent,
HeaderComponent,
PostListComponent
],
imports: [
BrowserModule,
FormsModule,
BrowserAnimationsModule,
MatInputModule,
MatCardModule,
MatButtonModule,
MatToolbarModule,
MatExpansionModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
import { TestBed, async } from '@angular/core/testing';
import { AppComponent } from './app.component';
import { PostListComponent } from './posts/post-list/post-list.component';

describe('AppComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
  declarations: [
    AppComponent,
    PostListComponent
  ],
}).compileComponents();
}));

it('should create the app', () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'mean-learning'`, () => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('mean-learning');
});

it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('mean-learning app is running!');
});
});


请让我知道我错在哪里,以及我如何解决这个问题

您好,您在行号4中输入了错别字,将
更改为
问题已解决

app.component.html代码

<app-header></app-header>
<main>
  <app-post-create></app-post-create>
  <aap-post-list></app-post-list>
</main>
现在将选择器更改为

从“@angular/core”导入{Component}”

从“@angular/core”导入{Component}”


现在它应该可以正常工作了

这是一个打字错误。在app.component.html中,将
替换为
。更好的是,将组件选择器更改为
应用程序帖子列表
。如果问题已解决,请单击回答上的已解决图标现在我收到此错误消息src/app/app.component.html:4:5-错误NG8001:“应用程序帖子列表”不是已知元素:如果“应用程序帖子列表”是角度组件,请验证它是否是此模块的一部分。如果“app post list”是一个Web组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到此组件的“@NgModule.schemas”以抑制此消息。src/app/app.component.ts:5:16 templateUrl:“./app.component.html”,组件AppComponent的模板中出现错误。先生,谢谢您的回答,我更改了它,但现在我收到以下消息:如果“app post list”是角度组件,则“app post list”不是已知元素,然后验证它是否是此模块的一部分。如果“app post list”是Web组件,则将“CUSTOM_ELEMENTS_SCHEMA”添加到此组件的“@NgModule.schemas”以抑制此消息。您已将该组件声明为
aap post list
。所以你也应该更改声明(选择器)。将选择器:“aap帖子列表”更改为“应用帖子列表”@NaveenKumar抱歉,我没有得到你的答案,请解释me@ayushflitzip现在检查我的答案
@Component({
selector: 'app-post-list',
templateUrl: './post-list.component.html'
})

export class PostListComponent {}