Solucionado (ver solução)
Solucionado
(ver solução)
3
respostas

Erro para achar o componente

Oi!

Fazendo o módulo 2, encontrei o seguinte erro "bizarro"(uahuaha):

Unhandled Promise rejection: Template parse errors:
'foto' is not a known element:
1. If 'foto' is an Angular component, then verify that it is part of this module.
2. If 'foto' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("
</div>
<div class="container">
        [ERROR ->]<foto></foto>
      </div>"): AppComponent@4:8 ; Zone: <root> ; Task: Promise.then ; Value: Error: Template parse errors:
'foto' is not a known element:
1. If 'foto' is an Angular component, then verify that it is part of this module.
2. If 'foto' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("
</div>
<div class="container">
        [ERROR ->]<foto></foto>
      </div>"): AppComponent@4:8
    at TemplateParser.parse (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:8530:21)
    at RuntimeCompiler._compileTemplate (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16905:53)
    at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:85)
    at Set.forEach (native)
    at compile (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:49)
    at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:192:28)
    at Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:85:43)
    at http://localhost:3000/node_modules/zone.js/dist/zone.js:451:57
    at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:225:37)
    at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:125:47) Error: Template parse errors:
'foto' is not a known element:
1. If 'foto' is an Angular component, then verify that it is part of this module.
2. If 'foto' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schema' of this component to suppress this message. ("
</div>
<div class="container">
        [ERROR ->]<foto></foto>
      </div>"): AppComponent@4:8
    at TemplateParser.parse (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:8530:21)
    at RuntimeCompiler._compileTemplate (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16905:53)
    at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:85)
    at Set.forEach (native)
    at compile (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:16828:49)
    at ZoneDelegate.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:192:28)
    at Zone.run (http://localhost:3000/node_modules/zone.js/dist/zone.js:85:43)
    at http://localhost:3000/node_modules/zone.js/dist/zone.js:451:57
    at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:225:37)
    at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:125:47)

Segue os arquivos:

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component'
import { FotoModule } from './foto/foto.module'

@NgModule({
    imports: [ BrowserModule, FotoModule ],
    declarations: [ AppComponent ],
    bootstrap: [ AppComponent ]

})

export class AppModule{  }

app.component.ts

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

@Component({
    moduleId: module.id,
    selector: 'app',
    templateUrl: './app.component.html'

})

export class AppComponent {  }

foto.module.ts

import { NgModule }      from '@angular/core';
import { FotoComponent }   from './foto.component';

@NgModule({
  declarations: [ FotoComponent ],
  exports: [FotoComponent]
})
export class FotoModule { }

foto.component.ts

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

@Component({
    moduleId: module.id,
    selector: 'foto',
    templateUrl: './foto.component.html'
})
export class FotoComponent {}

Como resolver? =]

3 respostas

Bom dia!

Você fez as alterações com o compilador do typescript ligado ?

Fiz sim. Por um acaso eu tive que reiniciar o linux agora, iniciei o ts e funcionou normalmente =]. Vlw Flavio!

solução!

Que boa notícia ! Sucesso e bom estudo meu aluno!