Tuesday, February 4, 2020

Integrate an existing Angular application into a .NET Core 3 MVC and Razor orchestration.

The cheatsheet here (by "admin") starts out with some of what I suggest here, namely running commands (from a command prompt navigated to the root of your application as "Administrator") like so:

  1. npm install -g @angular/cli
  2. ng new ClientApp --createApplication=false
  3. cd ClientApp
  4. ng generate application portal --routing --style=scss
  5. ng add @angular/material
  6. npm install
  7. ng build

 
 

The last of these commands behaves differently than just npm install insofar as it will make a dist folder which the rest of the app will read from when sucking Angular 8 into a view. Also, you will need to run this last command every time you make a change in the Angular stuff to update the rest of the application. Other challenges along the way you may face include this, this, and this as well. This needs to be shoved into a view where you loop in Angular.

<app-root></app-root>
<script src="/ClientApp/dist/portal/runtime-es2015.js" type="module"></script>
<script src="/ClientApp/dist/portal/runtime-es5.js" nomodule defer></script>
<script src="/ClientApp/dist/portal/polyfills-es5.js" nomodule defer></script>
<script src="/ClientApp/dist/portal/polyfills-es2015.js" type="module"></script>
<script src="/ClientApp/dist/portal/styles-es2015.js" type="module"></script>
<script src="/ClientApp/dist/portal/styles-es5.js" nomodule defer></script>
<script src="/ClientApp/dist/portal/vendor-es2015.js" type="module"></script>
<script src="/ClientApp/dist/portal/vendor-es5.js" nomodule defer></script>
<script src="/ClientApp/dist/portal/main-es2015.js" type="module"></script>
<script src="/ClientApp/dist/portal/main-es5.js" nomodule defer></script>

 
 

The way the blog posting in the very first link I give in this blog posting undertakes to summon in the markup here out of /ClientApp/dist/portal/index.html is overkill. Do your own thing. Jam this stuff into a partial.

No comments:

Post a Comment