Unable to define templateUrl App components file.
sri1980 opened this issue · 2 comments
sri1980 commented
I would like to move the html content into .html file and use the templateUrl instead of template. I am getting 404 error. Can you please help me, am i missing anything?
@component({
selector: 'app5',
template: `
<img [src]="angularImg" style="width: 100px;"/>
This was rendered by App5 which is written in Angular 6
<div>
<b> Count: {{ count }}</b><br/><br/>
<button (click)="increment()">local increment</button> Send a <b>local</b> increment event. This will
only increase the counter for the current app. <br/>
<button (click)="decrement()">local decrement</button> Send a <b>local</b> decrement event. This will
only decrement the counter for the current app. <br/>
<button (click)="globalIncrement()">global increment</button> Send a <b>global</b> increment event.
This will increase the counter for the current app and all other apps that listen to this event. <br/>
<button (click)="globalDecrement()">global decrement</button> Send a <b>global</b> decrement event.
This will increase the counter for the current app and all other apps that listen to this event. <br/>
</div>
<br />
<a [routerLink]="['/subroute1']" routerLinkActive="active">Angular route 1</a>
<a [routerLink]="['/subroute2']" routerLinkActive="active">Angular route 2</a>
<router-outlet></router-outlet>
`,
})
sri1980 commented
Thanks for your help. it is very good article.
fireappsAdmin commented
What error are you getting?
You need to use templateUrl instead of template.
Where are you putting the selector in the html?
What does you NgModule look like?