From 01bca4e1101b659cb824077e936d5bc04ad5d130 Mon Sep 17 00:00:00 2001 From: Chad Ostrowski Date: Sat, 31 May 2014 20:52:32 -0400 Subject: [PATCH] Add note about needing ng-app="myApp" in Step 5 This document was how I learned about using the inline, anonymous controller definition. It took me a long time and much frustration to figure out that I needed to change `ng-app` in my markup in order for this to work. I'm hoping to save some time for the next person who takes the same path as me. --- docs/content/tutorial/step_05.ngdoc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/content/tutorial/step_05.ngdoc b/docs/content/tutorial/step_05.ngdoc index 3e2fe3cee64d..38c025a68b71 100644 --- a/docs/content/tutorial/step_05.ngdoc +++ b/docs/content/tutorial/step_05.ngdoc @@ -140,6 +140,10 @@ anonymous function when registering the controller: phonecatApp.controller('PhoneListCtrl', ['$scope', '$http', function($scope, $http) {...}]); ``` +If you use the anonymous function syntax, the way you initialize your Angular app needs to change. +Instead of a simple `ng-app` in your markup, you'll need `ng-app='phonecatApp'`. Otherwise, you'll +get errors that your controller is undefined (not a function). + From this point onward, we're going to use the inline method in the tutorial. With that in mind, let's add the annotations to our `PhoneListCtrl`: