#Component does not render

3 messages · Page 1 of 1 (latest)

dusty ravine
#

Hello, I have a component which does not render in the index.html when app irs running on port 4200

<body> ... <app-upload></app-upload> <app-root></app-root> </body>

upload.component.html
<h2>File Upload</h2> <form> <input type="file" (change)="onFileSelected($event)" /> <button (click)="uploadFile()">Upload</button> </form> <p *ngIf="message">{{ message }}</p>

cinder vault
#

You're not supposed to have any other component in index.html than app-root, which is the root component of the application. If you want to display the upload component, it should be inside the root component's template (or in the template of another child component).

#

Also, you're obviously learning, but you're still using *ngIf, which has been replaced by @if for some time now. You should learn with up-to-date material.