Part 1 - How to setup AngularJS in MVC4 application

In this post, I would like to explain Part 1 - How to setup AngularJS in MVC4 application.

This is our First Post about AngularJS. Here I have explained a little about AngularJS and What we will learn in this section part by part. In this part (Part 1) I am going to explain how to setup AngularJS in MVC4 application.

{{Message}}
Part 1 - How to setup AngularJS in MVC4 application
 
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
    @* Here  ng-app="MyApp" is used for auto-bootstrap an AngularJS application. here ng-app="MyApp" means <body> element is the owner 
    of AngularJS application*@
<body ng-app="MyApp">
    @RenderBody()

    @Scripts.Render("~/bundles/jquery")
    @* Add Angular Library Here *@
    @Scripts.Render("~/bundles/angular")
    <script src="~/Scripts/MyApp.js"></script>
    @RenderSection("scripts", required: false)
</body>
</html>

Posted By :