You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
How to use prerendered templates by Asp.Net MVC Core Razor Engine as Angular2 template #838
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.
@ADefWebserver yes, if I change the templateUrl totemplate: require("./navmenu-top.component.html") it works, the "navmenu-top.component.html" file is in the same folder as "navmenu-top.component.ts"
changed the title [-]How to user prerendered template by Asp.Net MVC Core razor engine as Angular2 template[/-][+]How to use prerendered templates by Asp.Net MVC Core Razor Engine as Angular2 template[/+]on Apr 3, 2017
Activity
ADefWebserver commentedon Apr 3, 2017
Is
navmenu-topImportedandDeclaredin app.module.ts?skorunka commentedon Apr 3, 2017
@ADefWebserver yes, if I change the
templateUrltotemplate: require("./navmenu-top.component.html")it works, the "navmenu-top.component.html" file is in the same folder as "navmenu-top.component.ts"import { NavMenuTopComponent } from "./components/navmenu/navmenu-top.component";declarations: [ ... NavMenuTopComponent... ]What I need to achieve is: to have @component like:
Where the
/angular-templates/navmenu-topis an url to a Controller/Action, which renders the Angular2 HTML template.[-]How to user prerendered template by Asp.Net MVC Core razor engine as Angular2 template[/-][+]How to use prerendered templates by Asp.Net MVC Core Razor Engine as Angular2 template[/+]skorunka commentedon Apr 4, 2017
Found an answer here: http://stackoverflow.com/questions/41473511/how-to-render-asp-net-mvc-view-into-angular-2