简体   繁体   中英

angularJS route Error

So yeah here is my HTML and scripts witch get an error.. and i don't know why i just follow a tutorial on pluralsight shouldn't have much problems, but no..

    <body>

    <div class="navbar">
        <div class="navbar-inner">
            <ul class="nav">
                <li><a href="#/NewEvent">Create Event</a></li>
                <li><a href="/templates/EditProfile.html">Edit Profile</a></li>
                <li><a href="/templates/Event.html">Refresh</a></li>
            </ul>
        </div>
    </div>

   <div ng-view></div>



    <script src="../Scripts/angular.js"></script>  

    <script src="../Scripts/angular-route.js"></script>
    <script src="Content/jquery.min.js"></script>
    <script src="Content/underscore-1.4.4.min.js"></script>
    <script src="../Scripts/app.js"></script>
        <script src="Content/EditEventController.js"></script>
    <script src="Scripts/EventController.js"></script>
</body>



</html>

and here is my app.js:

 var eventsApp = angular.module('eventsApp', ['ngRoute'])
.config(function ($routeProvider) {
    $routeProvider.when('/NewEvent',
        {
            templateUrl: 'templates/tmp/Event.html',
            controller: 'EventController'


        })


});

and here is the error:

var ngRouteModule = angular.module('ngRoute', ['ng']).
                                provider('$route', $RouteProvider);

with the error Message: "Uncaught TypeError: Cannot read property 'module' of undefined"

Please help..

First, you declare the name of your own module, then you declare a list of modules your very own module depends on.

var ngRouteModule = angular.module('yourModule', ['listOfModules']).

In this case listOfModules contains ngRoute

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM