2 Replies - 1464 Views - Last Post: 30 July 2014 - 03:13 PM

#1 dakhipp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 06-December 13

Angular not defined in mean stack tutorial

Posted 30 July 2014 - 02:09 PM

I cannot get the angular side of my app up and running I am getting these 3 errors in the browser console:
Uncaught TypeError: Cannot read property '$$minErr' of undefined angular-resource.js:8
Uncaught TypeError: Cannot read property 'module' of undefined angular-route.js:24
Uncaught ReferenceError: angular is not defined

If I click my scripts in the browser dev tools they are all linking correctly and it is getting a code 200 in my server console, but it doesn't seem like the angular script is letting me create an angular object.

Here is my angular app page code:
angular.module('app', ['ngResource', 'ngRoute']);

angular.module('app').config(function($routeProvider, $locationProvider){
	$locationProvider.html5Mode(true);
	$routeProvider
		.when('/', {templateUrl: '/partials/main', controller: 'mainCtrl'});
});

angular.module('app').controller('mainCtrl', function($scope){
	$scope.myVar = "Hello Angular";
});



Here is my layout.jade page:
doctype
html 
	head
		//link(href="/favicon.icon", rel="shortcut icon", type="image/x-icon")
		link(rel="stylesheet" href="/css/bootstrap.css")
		link(rel="stylesheet" href="/vender/toastr/toastr.css")
		link(rel="stylesheet" href="/css/site.css")
	body(ng-app='app')
		block main-content
		include scripts 



Here is my included scripts.jade page:
script(type="text/javascript", src="/vender/jquery/jquery.js")
script(type="text/javasctipt", src="/vender/angular.min.js")
script(type="text/javascript", src="/vender/angular-resource/angular-resource.js")
script(type="text/javascript", src="/vender/angular-route/angular-route.js")
script(type="text/javascript", src="/app/app.js")



Here is a repository link if you want to see other parts of my code:
https://github.com/d...pp/meanTutorial

or let me know and I can paste what ever else you need to see. Thanks for the help!!

Is This A Good Question/Topic? 0
  • +

Replies To: Angular not defined in mean stack tutorial

#2 ArtificialSoldier  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 486
  • View blog
  • Posts: 1,809
  • Joined: 15-January 14

Re: Angular not defined in mean stack tutorial

Posted 30 July 2014 - 03:03 PM

It sounds like angular isn't being included, or is included too late. Check your browser's network tab to make sure that file is getting loaded before the angular-resource and angular-route files.
Was This Post Helpful? 1
  • +
  • -

#3 dakhipp  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 18
  • Joined: 06-December 13

Re: Angular not defined in mean stack tutorial

Posted 30 July 2014 - 03:13 PM

I used the min file in a closer directory to solve that problem, but it still didn't include angular. I did just use a cdn version of angular and everything seems to be working. I'm not sure why my local version of angular won't load right, I even tried an older version of angular. I used bower to install and it's the first time i've used bower so maybe that has something to do with it that I don't know about. if you have any ideas about including angular locally I'll try them out. thanks for the reply!

View PostArtificialSoldier, on 30 July 2014 - 03:03 PM, said:

It sounds like angular isn't being included, or is included too late. Check your browser's network tab to make sure that file is getting loaded before the angular-resource and angular-route files.

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1