Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angularjs ngRoute uncaught object error

I'm getting an uncaught object error in my console when trying to load my angularjs app. I don't know if it's related to ng-route.js or not, but that's all the error tells me is uncaught object

Here's my Code

HTML

<!doctype html>
<html class="no-js" lang="en" ng-app="selfservice">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Foundation</title>
    <link rel="stylesheet" href="css/app.css" />
    <script src="bower_components/modernizr/modernizr.js"></script>
    <script src="bower_components/angular/angular.min.js"></script>
    <script src="bower_components/angular-route/angular-route.min.js"></script>
    <script src="bower_components/jquery/dist/jquery.min.js"></script>
    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>
  </head>
  <body>
    <div id="template">

        <div id="view">
            <ng-view></ng-view>
        </div>

    </div>

    <script src="bower_components/foundation/js/foundation.min.js"></script>
    <script>
        //initialize foundation
        $(document).foundation();
    </script>
  </body>

app.js

//Initialize angular module include route dependencies

var app = angular.module("servicedesk", ['ngRoute']);

app.config(function ($routeProvider) {
   $routeProvider
       .when('/', {
           templateUrl:"partials/login.html",
           controller:"login"
       });
});

controller.js

app.controller("login", function ($scope) {
    return "";
});
like image 856
richbai90 Avatar asked May 28 '14 20:05

richbai90


1 Answers

ng-app should contain the name of the module. Change ng-app="selfservice" to ng-app="servicedesk".

like image 108
Anthony Chu Avatar answered Sep 24 '22 18:09

Anthony Chu