當我用@Input,它出現這個error:
Error in src/app/app.component.html:3:1 error NG8001: ‘hello-component’ is not a know element:
If ‘hello-component’ is Angular component, then verify that it is part of this module.
If ‘hello-component’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
3<hello-component [myName]=“123”>
src/app/app.component.ts:6:16
6 templateUrl: ‘./app.component.html’,
我按照你的方法去更改,都是有ERRO出現,它的ERROR 如下:
ERROR in src/app/app.component.html:3:1 - error NG8001: ‘helloComponent’ is not a known element:
if ‘helloComponent’ is an Angular component, then verify that it is part of this module.
To allow any element add ‘NO_ERRORS_SCHEMA’ to the ‘@NgModule.schemas’ of this component.
3 <helloComponent [myName]=“123”>
src/app/app.component.ts:5:16
是否需要在app.module.ts 加入這些:
import { HelloComponent } from ‘./hello.component’;
import { FormsModule } from ‘@angular/forms’;
declarations: [ AppComponent, HelloComponent ],