Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChristopher Jauregui
1,967 PointsMy 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';
(entry.component.html)
<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
Lou Groshek
3,948 PointsI had the same issue. It looks like
Component({
selector: 'app-entry-comment-form',
template: 'entry-comment-form.component.html'
})
needs to be:
Component({
selector: 'app-entry-comment-form',
templateUrl: 'entry-comment-form.component.html'
})