0

I am working on ASP.NET Web Forms application. I have added some angular controllers and other angular funcatinlity to application. Now i need to apply minification of JS and CSS files and i am trying to use in built bundling provider by System.Web.Optimization dll. I am getting error when applying bundling on angular.js and my angular code files. I am not understanding that what is causing error.

collection.Add(new ScriptBundle("~/bundles/startupbundle")
                .Include("~/Scripts/jquery-2.1.0.js")
                .Include("~/Scripts/jquery-ui-1.10.4.min.js")
                .Include("~/Scripts/jquery-migrate-1.2.1.min.js")
                .Include("~/Scripts/bootstrap.min.js")
                .Include("~/Scripts/modernizr-2.7.2.js")
                .Include("~/Scripts/jquery.blockUI.min.js")
                .Include("~/Scripts/select2.mi![enter image description here][1]n.js")
                .Include("~/Scripts/jquery.nicescroll.js")
                .Include("~/Scripts/jquery.smartWizard.js")
                .Include("~/Scripts/scripts.js")
                .Include("~/Scripts/kendo.all.min.js")
                .Include("~/Scripts/toastr.min.js")

                .Include("~/Scripts/underscore-min.js")

                .Include("~/Scripts/bootstrap.min.js")

                .Include("~/WebApp/AppScripts/master-page.js")
                .Include("~/WebApp/AppScripts/Dasboard.js")
                .Include("~/Scripts/angular.min.js")
               );

enter image description here

Ravi Mittal
  • 1,947
  • 4
  • 22
  • 37

1 Answers1

0

It seems that you're including your custom scripts before including Angular. You need to include Angular first otherwise you'll get runtime errors.

Snippet:

 ... // everything above this as before
 .Include("~/Scripts/angular.min.js")
 .Include("~/WebApp/AppScripts/master-page.js")
 .Include("~/WebApp/AppScripts/Dasboard.js")
);

Although it's hard to tell from your screenshot if this is the case. If my tip doesn't work, update your question with another screenshot showing that "Uncaught object" expanded (press the triangle to the left of it).

As a side note you should include Modernizr at the top of your page, so it shouldn't be in this bundle.

John-Philip
  • 617
  • 9
  • 20