【问题标题】:merged angular js app to mvc 5, and i keep getting this error将 Angular js 应用程序合并到 mvc 5,我不断收到此错误
【发布时间】:2016-09-30 13:14:22
【问题描述】:

以这种方式编写我的模块仍然正确吗?输出只是显示; ;在控制台中有这个错误

未捕获的错误:[$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?

var angularFormsApp = angular.module('angularFormsApp', ['ngRoute', 'ui.bootstrap']);

angularFormsApp.config(
["$routeProvider","$locationProvider",
    function ($routeProvider, $locationProvider) {
        $routeProvider
            .when("/home", {
                templateUrl: "app/Home.html",
                controller: "HomeController"
            })
            .when("/newAccountForm", {
                templateUrl: "app/AccountForm/afTemplate.html",
                controller: "afController"
            })
            .when("/updateAccount/:id", {
                templateUrl: "app/AccountForm/afTemplate.html",
                controller: "afController"
            })
            .otherwise({
                redirectTo: "/home"
            });
        $locationProvider.html5Mode(true).hashPrefix('!');
}]);

这些是我的捆绑包

    bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                "~/Scripts/jquery-{version}.js"));

    bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                "~/Scripts/jquery.validate*"));

    // Use the development version of Modernizr to develop with and learn from. Then, when you're
    // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
    bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                "~/Scripts/modernizr-*"));

    bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
              "~/Scripts/bootstrap.js",
              "~/Scripts/respond.js"));

    bundles.Add(new StyleBundle("~/Content/css").Include(
              "~/Content/bootstrap.css",
              "~/Content/site.css"));

    bundles.Add(new StyleBundle("~/bundles/asha/style").Include(
        "~/Content/bootstrap.css",
        "~/Content/app.css"));

    bundles.Add(new ScriptBundle("~/bundles/asha/script").Include(
        "~/Scripts/angular.js",
        "~/Scripts/angular-route.js",
        "~/Scripts/angular-ui/ui.bootstrap-tpls.js",
        "~/app/AngularFormsApp.js",
        "~/app/DataService.js",
        "~/app/ValidationDirective.js",
        "~/app/EmployeeForm/efController.js",
        "~/app/EmployeeForm/efDirective.js"));

    BundleTable.EnableOptimizations = true;
}

【问题讨论】:

  • 您能否详细说明您要控制台的内容是什么,因为这是一个注入器模块错误,这意味着 angular-router.js 或 ui.bootstrap 路径错误。
  • 是的,你是对的,通过检查我的 MVC 脚本文件夹中的所有名称来修复它,谢谢队友的欢呼!
  • 不客气,请喜欢我的回答。谢谢

标签: .net angularjs model-view-controller


【解决方案1】:

因为这是一个注入器模块错误,这意味着 angular-router.jsui.bootstrap 路径错误。

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多