Last post Oct 19, 2017 02:43 PM by bruce (sqlwork.com)
Oct 19, 2017 09:31 AM|Allen4Tech|LINK
I use VS2017 to create ASP.NET Core 2.0 web application, and I select Angular template, but the generated project still contains razor view, why? Any blog or articles can anylize the project's structure and how the client side and server side code organized?
Oct 19, 2017 02:01 PM|proskilly|LINK
The razor view contains the html for the page that the angular app is located within and specifies where on the page the angular app goes and includes the required js file for your angular app.
For example mine contains this : <app asp-prerender-module="ClientApp/dist/main-server">Loading...</app>
Which is the position on the page where the angular app is rendered.
The client side code is located in a folder called /ClientApp/app the angular app and components source code is there, when the angular compiles it's resulting files are located in /wwwroot/dist
Oct 19, 2017 02:43 PM|bruce (sqlwork.com)|LINK
note also, the
tag helper. this tag helper starts a node web server, and calls it to get the angular pre-render html (app.module.server.ts). so the template requires node be installed on the server hosting your asp/net core application.
you must also keep the server version updated. see:
note: I'm a react user and more familiar with reacts server render support.
note 2: the template also includes the webpack middleware. this is only used in dev mode, and starts webpack watch (running webpack as a web service in node). the sample webpack config, supports hot module loading (if you save a ts/js module file, it automatically
loaded in the browser. you also may want to inspect the vendor webpack file.