Template parse errors (Angular CLI)

Asked

Viewed 560 times

1

I’m studying Angular by doc, but when I arrived in Add HeroService.getHero(), the application gave refresh and presented the following error:

Uncaught Error: Template parse errors: Can’t bind to 'Hero' Since it isn’t a known Property of 'app-Hero-Detail'. 1. If 'app-Hero-Detail' is an Angular Component and it has 'Hero' input, then Verify that it is part of this module. 2. If 'app-Hero-Detail' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Ngmodule.schemas' of this Component to Suppress this message. 3. To allow any Property add 'NO_ERRORS_SCHEMA' to the '@Ngmodule.schemas' of this Component. (" ][Hero]="selectedHero">

"): ng://Appmodule/Herodetailcomponent.html@8:21 at syntaxError (Compiler.js:2547) At templateparser.push.. /node_modules/@angular/Compiler/fesm5/Compiler.js.Templateparser.parse (Compiler.js:19495) At jitcompiler.push.. /node_modules/@angular/Compiler/fesm5/Compiler.js.Jitcompiler. _parseTemplate (Compiler.js:25041) At jitcompiler.push.. /node_modules/@angular/Compiler/fesm5/Compiler.js.Jitcompiler. _compileTemplate (Compiler.js:25028) at Compiler.js:24971 At Set.foreach () At jitcompiler.push.. /node_modules/@angular/Compiler/fesm5/Compiler.js.Jitcompiler. _compileComponents (Compiler.js:24971) at Compiler.js:24881 At Object.then (Compiler.js:2538) At jitcompiler.push.. /node_modules/@angular/Compiler/fesm5/Compiler.js.Jitcompiler. _compileModuleAndComponents (Compiler.js:24880)

And I don’t understand what’s going on, I tried to look for similar problems, but I couldn’t understand..

The codes I made available on git, since it’s quite something (4 components). I’m using the Angular CLI.

  • can add the stretch that Voce is acting

1 answer

2


Good evening, you have some problems in your Komponent, I will list below I believe that this way can correct!

1 - In Hero-Detail.component.ts you have property Hero but she is not with the directive Input of the Angular so it is not possible to receive/pass value as it does on line 9 in Hero-Detail.component.html.

2 - You are calling yourself on Hero-Detail.component.html This makes no sense and escapes from the structure and definition of Angular

In your case the error occurs because Angular does not find the app-Hero-Detail defined in row 9.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.