Bundles Not Loading in ASP.NET MVC 4

I added the bundle in BundleConfig.cs as shown below:

 bundles.Add(new ScriptBundle("~/bundles/angular").Include("~/Scripts/angular.min*"));

In the _Layout.cshtml I have the following:

<body>
    @RenderBody()

    @Scripts.Render("~/bundles/jquery")

    @Scripts.Render("~/bundles/angular")

    @RenderSection("scripts", required: false)
</body>
</html>

In the network traffic it does not show the angular file.

Answers


Bundling in ASP.NET MVC is quite clever in that it understands *.min and when to use or no to use it. So if you do this in your bundle:

bundles.Add(new ScriptBundle("~/bundles/angular").Include("~/Scripts/angular.js"));

In debug-mode, it will send a request for "/scripts/angular.js" and in release-mode it will send a request to "/scripts/angular.min.js"

In order to benefit from this, you should put both the original and the minified file in your scripts folder. That way, when you're debugging you have full access to the uncompressed source and in your production environment, the optimized file will be loaded


Need Your Help

stop asp.net btnsave.click event from firing when validation fails

javascript asp.net validation

I have this java script validation function that fires when the client clicks btnsave

Sencha Touch Audio in Carousel

extjs sencha-touch-2 html5-audio

I would like to have a small mp3 played every time a new panel is shown in the carousel. I used the audio xtype with autoplay but this results in an cacophony of sounds on startup. The problem occu...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.