photo.component.html
app.module.ts import { BrowserModule } from '@angular/platform-browser'; import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { AppComponent } from './app.component';
import { PhotoComponent } from './photo/photo.component';
@NgModule({ declarations: [ AppComponent, PhotoComponent ], imports: [ BrowserModule ], providers: [], bootstrap: [AppComponent] }) export class AppModule { }
photo.component.ts import { Component, OnInit } from '@angular/core';
@Component({ selector: 'ap-foto', templateUrl: './photo.component.html', styleUrls: ['./photo.component.css'] }) export class PhotoComponent implements OnInit {
constructor() { }
ngOnInit() { }
}
Eu fiz como está no vídeo e continua dando esse erro no browser e o componente não é exibido: compiler.js:14687 Uncaught Error: Template parse errors: 'ap-photo' is not a known element: 1. If 'ap-photo' is an Angular component, then verify that it is part of this module. 2. If 'ap-photo' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("[ERROR ->]
"): ng:///AppModule/AppComponent.html@0:0 'ap-photo' is not a known element: 1. If 'ap-photo' is an Angular component, then verify that it is part of this module. 2. If 'ap-photo' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. (" [ERROR ->]"): ng:///AppModule/AppComponent.html@1:0 at syntaxError (compiler.js:215) at TemplateParser.push../node_modules/@angular/compiler/fesm5/compiler.js.TemplateParser.parse (compiler.js:14687) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._parseTemplate (compiler.js:22687) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileTemplate (compiler.js:22674) at compiler.js:22617 at Set.forEach () at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileComponents (compiler.js:22617) at compiler.js:22527 at Object.then (compiler.js:206) at JitCompiler.push../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents (compiler.js:22526)