me-12 / single-spa-portal-example

Example project on how to combine multiple SPA's on a single Website
MIT License
407 stars 136 forks source link

Unable to define templateUrl App components file. #48

Open sri1980 opened 6 years ago

sri1980 commented 6 years ago

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: `


This was rendered by App5 which is written in Angular 6
    <br />

    <div>
        <b> Count: {{ count }}</b><br/><br/>
        <button (click)="increment()">local increment</button>&nbsp;Send a <b>local</b> increment event. This will
        only increase the counter for the current app. <br/>

        <button (click)="decrement()">local decrement</button>&nbsp;Send a <b>local</b> decrement event. This will
        only decrement the counter for the current app. <br/>

        <button (click)="globalIncrement()">global increment</button>&nbsp;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>&nbsp;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>&nbsp;
    <a [routerLink]="['/subroute2']" routerLinkActive="active">Angular route 2</a>

    <router-outlet></router-outlet>
`,

})

sri1980 commented 6 years ago

Thanks for your help. it is very good article.

fireappsAdmin commented 6 years ago

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?