How to use prerendered templates by Asp.Net MVC Core Razor Engine as Angular2 template #859

Closed
opened 2025-08-09 17:17:57 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @skorunka on 4/3/2017

Hi, I have a Controller/Action which renders a view in an Angular2 template syntax, available on url /angular-templates/navmenu-top. Typing this url in a browser, renders out html, so I know it works.

When I set the templateUrl in a @Component attribute to /angular-templates/navmenu-top, I get this error:

./ClientApp/app/components/navmenu/navmenu-top.component.ts
Module not found: Error: Can't resolve './/angular-templates/navmenu-top' in 'C:\Projects\...ClientApp\app\components\navmenu'
 @ ./ClientApp/app/components/navmenu/navmenu-top.component.ts 21:18-55
 @ ./ClientApp/app/app.module.ts
 @ ./ClientApp/boot-client.ts
 @ multi event-source-polyfill webpack-hot-middleware/client?path=%2F__webpack_hmr ./ClientApp/boot-client.ts 


Do I need to change any webpack config, add any loader?

Thank you.
*Originally created by @skorunka on 4/3/2017* Hi, I have a Controller/Action which renders a view in an Angular2 template syntax, available on url `/angular-templates/navmenu-top`. Typing this url in a browser, renders out html, so I know it works. When I set the `templateUrl` in a `@Component` attribute to `/angular-templates/navmenu-top`, I get this error: ``` ./ClientApp/app/components/navmenu/navmenu-top.component.ts Module not found: Error: Can't resolve './/angular-templates/navmenu-top' in 'C:\Projects\...ClientApp\app\components\navmenu' @ ./ClientApp/app/components/navmenu/navmenu-top.component.ts 21:18-55 @ ./ClientApp/app/app.module.ts @ ./ClientApp/boot-client.ts @ multi event-source-polyfill webpack-hot-middleware/client?path=%2F__webpack_hmr ./ClientApp/boot-client.ts Do I need to change any webpack config, add any loader? Thank you.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#859
No description provided.