The content generated by the angluarjs2 project is merged into the asp.net mvc4 project and released.

Source: Internet
Author: User

The content generated by the angluarjs2 project is merged into the asp.net mvc4 project and released.

  • Application scenarios
Angular2 (NG2) project and. net mvc project are developed respectively. In the early stage, cross-origin access is used for parallel development. In the later stage, only the production version of The NG2 project needs to be merged into the. net project.
  • NG2 Project Overview
  • . Net mvc Project Overview:
  • Specific steps (only the operation content in. net mvc is described)
  • Route content settings
  • // Prevent the user from refreshing the route pointing to the wrong routes. mapRoute (name: "ngdefault", url: "content/dist /{*.} ", defaults: new {controller =" Home ", action =" Index "}); // The Calling content routes in the original NG2 development framework. mapRoute (name: "MyRoute", url: "api/{controller}/{action}"); // normal page request for routes. mapRoute (name: "Default", url: "{controller}/{action}/{* pathInfo}", defaults: new {controller = "Home ", action = "Index "});
  • Page settings (The following is the page content corresponding to my Home controller Index)

  • @ {Layout = null ;}<! DOCTYPE html> @ * The following content should be set based on the content generated by your NG2 project. For details, refer to the content on the NG2 project boot page. * @ <Script type = "text/javascript" src = "~ /Content/dist/inline. js "> </script> <script type =" text/javascript "src = "~ /Content/dist/styles.41c78f28e60ca8b5fd69. bundle. js "> </script> <script type =" text/javascript "src = "~ /Content/dist/scripts. bc1943ee0f025606a729. bundle. js "> </script> <script type =" text/javascript "src = "~ /Content/dist/main.2ad5580a0f71e9dcee3e. bundle. js "> </script> </body> 
  • NG2 project placement location

The published content is placed in the content directory. Therefore, you must set <base href = "/content/dist/"> in the head of the index page.

  • Implementation content
There are other better ways to operate, please kindly advise, and thank you again.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.