3
respostas

Can't bind to 'url' since it isn't a known property of 'ap-photo'

git https://github.com/jmkinjo/angular.git

compiler.js:215 Uncaught Error: Template parse errors: Can't bind to 'url' since it isn't a known property of 'ap-photo'.

  1. If 'ap-photo' is an Angular component and it has 'url' input, 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.
  3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("<ap-photo *ngFor="let photo of photos" [ERROR ->][url]="photo.url" [description]="photo.description"> "): ng:///AppModule/AppComponent.html@2:4 Can't bind to 'description' since it isn't a known property of 'ap-photo'.
3 respostas

Fala ai Jorge, tudo bem? Acho que seria app-photo não? Verifique como esta o selector do componente Photo.

Espero ter ajudado.

O seletor está correto é ap-photo mesmo. Estou com o mesmo problema.

Já sei como resolver, provavelmente você não recortou o trecho de app.component.html :

<ap-photo 
    *ngFor="let photo of photos" 
    [url]="photo.url" 
    [description]="photo.description">
</ap-photo>

Você copiou e colou em photo-list.component.html, sem remover o código do .html anterior.

Para resolver o problema, você precisa deixar app.component.html vazio. Pois o resposável por exibir as fotos será o photo-list.component.html e não app.component.html.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software