I'm evaluating the lastest bits of Angular (7+) and CLI. I've done parts of the 'Tour of Heroes' tutorial. I can run 'ng build' to get the production bits.
However, an important requisite is the use of MVC views for component templates.
So instead of
templateUrl: './app.component.html'
I want to use
templateUrl: '/Template/Index'
for various reasons (translated templates being one). I do understand this is not the 'pure' Angular way of doing thing.
With this code in place, 'ng build' no longer works:
ERROR in ./src/app/app.component.ts
Module not found : error : Can't resolve './/Template/Index' in 'D:\\Angular\\TourOfHeroes\\TourOfHeroes\\src\\app'
I've searched for hours how to omit building the templates, but I can't find an answer. ng eject is depricated. It guides me to ngx-build-plus, but I don't see how this can help me.
What steps should I take to get this working?
EDIT:
Question How to using MVC views (*.cshtml) as templates in Angular 2? is not related. I know how to use MVC views in Angular. What I don't know is how to tell 'ng build' to omit these templates (as they are not static at all).
You might have to switch to webpack/rollup/systemjs-builder in order to create builds omitting baking in templates. Angular CLI doesn't support such scenario.
One caveat - you will be building in development mode, aot doesn't support dynamic templates (not in straightforward way)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.