user2860954 user2860954 - 1 year ago 119
AngularJS Question

Reference Error - angular not defined

the following is my app.html - template where i will be injecting my other partial views as to come,

<html ng-app="billApp">
<!-- SCROLLS -->
<!-- load bootstrap and fontawesome via CDN -->
<link rel="stylesheet" href="//" />
<link rel="stylesheet" href="//" />

<!-- SPELLS -->
<!-- load angular via CDN -->
<script src=""></script>
<script src="//"></script>
<script src="script.js"></script>

<!-- define angular controller -->
<body ng-controller="mainController">


<div id="main">
{{ message }}

<!-- angular templating -->
<!-- this is where content will be injected -->

And this is the script.js file which is the controller for the application,

// script.js

// create the module and name it scotchApp
var billApp = angular.module('billApp', []);

// create the controller and inject Angular's $scope
billApp.controller('mainController', function($scope) {

// create a message to display in our view
$scope.message = 'Everyone come and see!';

while i try to run the script.js file using my commandline

  1. change directory to nodejs directory

  2. type in 'node path-of-the-project-file\script.js'

which throws the following error,
var billApp = angular.module('billApp', []);
Reference error angular not defined.

I m somehow missing out on some basic detail. It would be great if someone could give me some directions here

Answer Source


<script src="//"></script>

line with

<script src=""></script>

Because its not getting library which is required by ngResource.


Include this line in the beggining

<script src=""></script>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download