Using the Angularjs language under ASP. (a): Hello your Name

Source: Internet
Author: User

After the new Spring Festival, share the first tutorial.

is to teach a new friend to learn the new AngularJs language using ASP.

One, create a new empty Web project. Use NuGet to download AngularJs and jquery.
Two, configure BundleConfig.cs:

 Public classBundleconfig {//for more information on bundling, visit         Public Static voidregisterbundles (bundlecollection bundles) {//bundles. ADD (New Stylebundle ("~/bundles/css"). Include (//"~/content/css/angularvalidate.css"//            ));bundles. ADD (NewScriptbundle ("~/bundles/jquery"). Include ("~/scripts/jquery-3.1.1.js"                        )); Bundles. ADD (NewScriptbundle ("~/bundles/angular"). Include ("~/scripts/angular.js",               "~/scripts/angular-route.js"               )); }    }
Source Code

Three, configure Global.asax. Write the Application_Start () method to enable the Angularjs and jquery references above bundles.

 Public class MvcApplication:System.Web.HttpApplication    {        protectedvoid  Application_Start ()        {            Arearegistration.registerallareas ( );            Filterconfig.registerglobalfilters (globalfilters.filters);             true ;            Bundleconfig.registerbundles (bundletable.bundles);            Routeconfig.registerroutes (routetable.routes);        }    }
Source Code

Four, the project uses the ASP. NET MVC Framework layout:

Five, create a controller for ASP. NET MVC:

Six, under the project, create a ANGULARJS directory that will be used to store ANGULARJS code documents, such as apps or controllers. Create a new app.js below

Seven, create a view for ASP. NET MVC:

The above HTML program, has used the Ng-app,ng-model and ng-bing and other instructions, the actual explanation, can be officially explained.

Here's a demonstration of the program running interaction:

Using the Angularjs language under ASP. (a): Hello your Name

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: 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.