Search Posts

AngularJS Bundle Config failing (angular-sanitize.js)

System.Web.HttpException: The controller for path ‘/bundles/angular/angular-resource.min.js.map’ was not found or does not implement IController.

This error is thrown on every page load across my application. Since I’m not bundling/minifying in Debug, this only occurs in QA/Dev and Production

I’ve tried this: angular resource is mistaken as C# MVC controller (like adding the .min script tags to index.cshtml in-line, and the other suggestions)

An I’ve read this: MSDN: Bundling and Minification

Here is the relevant code:

BundleConfig.cs

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
#if (!DEBUG)
        BundleTable.EnableOptimizations = true;
        bundles.UseCdn = true;
#endif

        bundles.Add(new ScriptBundle("~/bundles/jquery/script")
            .Include(
                "~/Scripts/jquery-{version}.js",
                "~/Scripts/jquery-ui-{version}.js",
                "~/Scripts/jquery.validate*",
                "~/Scripts/jquery.signalR-{version}.js"
                )
            );

        bundles.Add(new ScriptBundle("~/bundles/angular/script")
            .Include(
                "~/Scripts/angular.js",
                "~/Scripts/ui-bootstrap-modal.js",
                "~/Scripts/angular-animate.js",
                "~/Scripts/angular-mocks.js",
                "~/Scripts/angular-route.js",
                "~/Scripts/angular-resource.js",
                "~/Scripts/angular-sanitize.js",
                "~/Scripts/angular-datepicker.js"
                )
            );

        bundles.Add(new ScriptBundle("~/bundles/application/script")
            .IncludeDirectory("~/app", "*.js", true)
            );

        //Markup removed for clarity.
    }
}

index.cshtml

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

@Scripts.Render("~/bundles/application/script")

//Markup removed for clarity.

Directory Paths

(Project.Web)/Scripts/angular-{whatever}.js
(Project.Web)/Scripts/angular-{whatever}.min.js
(Project.Web)/Scripts/angular-{whatever}.min.js.map

This include angular-sanitize, of course

I’ve also tried both removing and including

//# sourceMappingURL=angular-sanitize.min.js.map

from angular-sanitize.min.js

If you need more information – please leave a comment! Thanks

Source: AngularJS

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.