I have a Controller/Action which renders a View in an Angular2 template syntax; url is /angular-templates/navmenu-top
. Typing this url in a browser, renders out html, so I know it works.
I would like to use that URL as a templateUrl
for one of my Angular2 components:
@Component({
selector: "nav-menu-top",
templateUrl: "/angular-templates/navmenu-top"
})
Unfortunately, I got this error:
./ClientApp/app/components/navmenu/navmenu-top.component.ts
Module not found: Error: Can't resolve './/angulartemplates/topnav' 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
My solution is build on top of https://github.com/aspnet/JavaScriptServices. It uses webpack for bundling the resources.
Here is my webpack.config.js file: https://github.com/aspnet/JavaScriptServices/blob/dev/templates/Angular2Spa/webpack.config.js
And folder structure with a Controller code:
I just cant make it working. It it because of webpack config?
Thank you.