简体   繁体   中英

display angular2 app within asp.net mvc application

Referenced Tutorial I am following this tutorial but i wanted to display my angular2 app based on a tab click from the menu rather than have it default load the angular app. so in my mvc i have a menu bar : Home, About, Contact tabs and i would like to load my angular2 app once i click the About tab... How can i configure that?

How can i configure a link in asp.net mvc to route to the angular app? Would i have to change the app/main.ts and the systemjs.config.js file?

Step 1

Open _Layout.cshtml and cut angular scripts as follows:

在此处输入图片说明

Step 2

Then remove

<my-app>Loading...</my-app>

tag from Index.cshtml

在此处输入图片说明

Step 3

and add it to About.cshtml . Also add angular scripts that we have already copied from step1 to scripts section:

在此处输入图片说明

That's all. Here is the result

在此处输入图片说明

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM