Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Angular Basics Angular Basic Forms Setting Up a Form Group

My form is not showing on my page but the console is not giving me an error

this is my (entry-comment-form.component.html) file

<form> <div> <label for="name">Name</label> <input type="text" name="name"[(ngModel)]="name" /> </div> <div> <label for="comment">Comment</label> <textarea name="comment" [(ngModel)]="comment"></textarea> </div> <div> <button>Submit</button> </div> </form>

(entry-comment-form.component.ts) file

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

@Component({ selector: 'app-entry-comment-form', template: 'entry-comment-form.component.html' })

export class EntryCommentFormComponent { name : string; comment: string;

} (index.ts) file

export * from './shared/entry.service'; export * from './entry-list/entry-list.component'; export * from './entry/entry.component'; export * from './entry/entry-comment-form.component';


<h2>{{entry.title}}</h2> <figure> <img src="{{entry.photo}}"> <figcaption>{{entry.description}}</figcaption> </figure> <div class="actions"> <button type="button" (click)="isLiked = !isLiked" [ngClass]="{liked: isLiked}">♥</button> <button type="button" (click)="showComments = !isLiked ">Comments ({{entry.comments.length}})</button>

</div> <div class="comments" *ngIf="showComments"> <div class="comment" *ngFor="let comment of entry.comments"> <p><strong>{{comment.name}}</strong>{{ comment.comment}}</p> </div> <app-entry-comment-form></app-entry-comment-form> </div>

1 Answer

I had the same issue. It looks like

  selector: 'app-entry-comment-form', 
  template: 'entry-comment-form.component.html' 

needs to be:

  selector: 'app-entry-comment-form', 
  templateUrl: 'entry-comment-form.component.html'