当我尝试引用Angular材料时,我得到了Uncaught Error:[$ injector:modulerr] http://errors.angularjs.org/1.2.21/$injector/modulerr?

时间:2016-10-26 12:17:22

标签: javascript angularjs angular-material

如果我尝试引用角度材料,我会收到错误:未捕获错误:[$ injector:modulerr] http://errors.angularjs.org/1.2.21/ $ injector / modulerr?。如果我删除引用代码工作正常,为什么? 提前感谢您的帮助。

这是我的主要布局页面:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" 
          content="width=device-width, initial-scale=1.0">
    <title>@ViewBag.Title - Register</title>
    @Styles.Render("~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body data-ng-app="main">
    <div class="navbar navbar-inverse navbar-fixed-top">
        <div class="container">
            <div class="navbar-header">
                @Html.ActionLink("Register", "Index", "Home",new { area = "" }, new { @class = "navbar-brand" })
            </div>
            <div class="navbar-collapse collapse">
                <ul class="nav navbar-nav">
                    <li>@Html.ActionLink("Customers", "Customer","Home")
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <div class="container body-content">
        @RenderBody()
        <hr />
        <footer>
            <p>&copy; @DateTime.Now.Year</p>
        </footer>
    </div>
    @Scripts.Render("~/bundles/angular")
    @Scripts.Render("~/bundles/jquery")
    @Scripts.Render("~/bundles/bootstrap")
    <script type="text/javascript">
        window.MyApp = {};
        MyApp.rootPath = '@Url.Content("~")';
    </script>
    <script src="~/App/Validator.js"></script>
    <script src="~/App/App.js"></script>
    @RenderSection("scripts", required: false)
    <script type="text/javascript">
        @RenderSection("jsCode", required: false)
    </script>
</body>
</html>

这是App.js

var commonModule = angular.module('common', ['ngRoute']);
var mainModule = angular.module('main', ['common', 'ngMaterial']);

BundleConfig.cs

bundles.Add(new ScriptBundle("~/bundles/angular").Include(
                  "~/Scripts/angular.js",
                  "~/Scripts/angular-route.js",
                  "~/Scripts/angular-material.js"));

0 个答案:

没有答案