Template parse errors (Angular CLI)

0

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

  

compiler.js: 2547 Uncaught Error: Template parse errors:   Can not bind to 'hero' since it is not 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'm not understanding what is happening, I tried to look for similar problems, but I could not understand.

The codes I made available in the git , since it is quite a thing (4 components). I'm using the Angular CLI.

    
asked by anonymous 09.11.2018 / 00:01

1 answer

1

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

1 - In hero-detail.component.ts you have hero property however it does not have the Input directive form can not receive / pass value as it does on line 9 in hero-detail.component.html .

2 - You are calling the component itself in hero-detail.component.html This does not make sense and runs away from the structure and definition of the Angular

In your case, the error occurs because Angular does not find the app-hero-detail defined in line 9.

    
09.11.2018 / 00:50