无法实例化MyApp模块

时间:2016-10-28 09:38:33

标签: angularjs

在我的App.js中,当我添加“var app = angular.module('MyApp',['ngRoute.dirPaginate'])”我得到此错误,如果我删除ngRoute其工作正常

错误:[$ injector:nomod]模块'dirPaginate'不可用!您要么错误拼写了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。 http://errors.angularjs.org/1.5.6/ $注射器/ NOMOD?P0 = dirPaginate

MYApp.Js

var app = angular.module('MyApp', ['ngRoute.dirPaginate'])

_Layout.Cshtml

<body ng-app="MyApp">

    <div class="container body-content">
        @RenderBody()
        @*<hr />
            <footer>
                <p>&copy; @DateTime.Now.Year - My ASP.NET Application</p>
            </footer>*@
    </div>

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


    <script src="~/Scripts/MyApp.js"></script>
    @RenderSection("scripts", required: false)
</body>

1 个答案:

答案 0 :(得分:1)

将ut var Myapp更改为

var app = angular.module('MyApp',['angularUtils.directives.dirPagination','ngRoute'])

相关问题