Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70779

Can't use components

$
0
0

@tux wrote:

Hello! I have created a component, but can’t use it. If i add the component in the AppModule declarations, entryComponents and exports i receive an error: Template parse errors: Can't bind to 'composition' since it isn't a known property of 'app-composition-item'.. Then i tried to import the AppModule in the pages module and receive: Error: RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.. But if i add it to page module declarations it works, but i can declarate component only once, so i can’t use it in another pages.
Here the how i tried to use it.
In the page i want to use component:

<div *ngFor="let favorite of favorites">
    <app-composition-item [composition]="favorite.composition"></app-composition-item>
</div>

Here the component:

@Component({
  selector: 'app-composition-item',
  templateUrl: './composition-item.component.html',
  styleUrls: ['./composition-item.component.scss'],
})
export class CompositionItemComponent {

  @Input() public composition: IComposition;

  constructor() {
  }
}

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70779

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>