Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialFaddah Wolf
12,811 Pointsgoogle api cdn does not work in downloaded code for angular v.1.2.2 or 1.3.5
hello Alex Vanston ,
i downloaded the code files to follow along with your AngularJS basic course here on Treehouse. i'm going over the $scope
property part of the module right now.
however, you provided no accompanying HTML file to run with the scopes.js demonstration file that you also show in the video.
since most of the things in that scopes.js file just show up in the console log, i simply tried temporarily changing the javascript script tag source reference in the main index.html file from app.js
to the scopes.js
. however, when i do that, i get the following error about the javascript script tag reference to the google api cdn reference itself in the console --
angular.js:10071 Error: [ng:areq] http://errors.angularjs.org/1.2.25/ng/areq?p0=stageFourCtrl&p1=not%20a%20function%2C%20got%20undefined
at Error (native)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:6:450
at Db (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:19:106)
at Wa (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:19:193)
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:67:403
at http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:54:25
at r (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:7:392)
at N (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:53:396)
at g (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:47:256)
at g (http://ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js:47:273)
this happens whether i use the google api CDN reference you put in the files --
//ajax.googleapis.com/ajax/libs/angularjs/1.2.25/angular.min.js
or the more current google api CDN reference, angularjs v.1.3.5 --
//ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js
could you please help me figure out what is going wrong here? thank you.
best,
-- faddah wolf portland, oregon, u.s.a.
2 Answers
Alex Vanston
313 PointsHey Faddah,
Based on the error code you're seeing, it's likely because that index.html
file is asking for the StageFourCtrl
, while the scopes.js
file only defines ScopesCtrl
. We didn't include any html for that section, since it is all just console.logs, and we hoped it'd be easier to simply read along with the comments to understand what was being outputted, instead of having to bounce back and forth between two windows.
That said, if you'd like to include it, simply updating the ng-controller="StageFourCtrl"
to ng-controller="ScopesCtrl"
should give you the console logging that you'd like.
Hope that helps, let me know if you have any other questions,
Alex
Faddah Wolf
12,811 Pointshi Alex Vanston ,
thank you for responding back so quickly to both my post here and my tweet. d'oh! that did it, changing it to ng-controller="ScopesCtrl"
. thank you very much. silly me - i should have thought to look at the ng-app
and ng-controller
attributes in the html -- it's just because the error in the console indicated the angular lib itself, i thought something might be wrong there. live & learn.
just to let you know, i am enjoying your course very much, but think there are some who feel lost with it - as indicated by this thread. i will be making a separate forum post later tonight or tomorrow on suggestions that i think would help improve this for people -- like having included a pre-rolled HTML file in the downloadable source code to work with the $scopes example. just my suggestions. look for that a bit later.
thank you again for the help.
best,
-- faddah wolf portland, oregon, u.s.a.