Austin
Austin

Reputation: 3080

Trouble getting AngularJS app to start

I looked at AngularJS this summer and I am trying to port my old plunker (http://plnkr.co/edit/uhwXJ456OyRFQbXnz1rS?p=info to Visual Studios.

I made a new project and I have a HomeController. I then made a Home view, and added the file Index.cshtml to it. After that I just added my files in and now I am having trouble getting it to start up.

I get the errors "Angular is not defined", and "Cannot read property 'module' of undefined".

In my Index.cshtml I have the following.

<!DOCTYPE html>
<html ng-app="app">
<head>
    <title>League of Dataz</title>
    <!-- SCROLLS -->
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" />
    <link rel="stylesheet" href="~/Content/bootstrap.css" />
    <link rel="stylesheet" href="~/Content/style.css" />

    <!-- SPELLS -->
    <script src="~/Scripts/angularjs.js"></script>
    <script src="~/Scripts/angular-route.js"></script>
    <script src="~/Scripts/app.js"></script>
    <script src="~/Scripts/jquery-1.9.1.js"></script>
</head>
<body ng-controller="HomeController">
    <nav class="navbar navbar-default">
        <div class="container">
            <ul class="nav navbar-nav navbar-left">
                <a href="#home">Home</a>
                <a href="#login">Login</a>
                <a href="#account">Accounts</a>
                <a href="#n00b">BrokenURL</a>
            </ul>
        </div>
    </nav>
    <div class="col-xs-12" id="view" ng-view></div>

</body>
</html>

I believe I had to do some weird work-arounds in order for this to work on Plunker, and now I am having trouble piecing together how it should actually be coded in the real world.

I stuck the VS Web Express 2013 project on this Zip site if anyone needs a better picture of what is going on, it's a tiny file since I can't even get it to run yet: LeagueData

Upvotes: 0

Views: 43

Answers (1)

Joshua
Joshua

Reputation: 3603

Check your paths. Angular being undefined means that the JS lib isn't loading. When you pull it up in the browser, open the web developer tools and check the network - see where it's trying to load the javascript file from.

Upvotes: 1

Related Questions