Learn AngularJS --- Attach promo to scope


#1

In AngularJS , under "Learn", Instructions part 2 , page 2/11 :

" 2. Likewise, any new properties attached to $scope will become available to use in the view. In the controller, attach promo to $scope, and set its value to your own string. "

When I clicked "run", it gives the error message :

Did you add $scope.promo to the controller?

Where exactly do I type ? If someone can show me the exact syntax and how it should be written , appreciate it ...


#3

I am having a similar issue.


#4

I figured it out by using dot notation. The formatting for the code is not the best on this tutorial. Luckily my Javascript notes from a previous codeacademy course helped me. Put the extra scope.promo within the function;

$scope.title = 'Todd is cool!';
$scope.promo = 'This is a promo!';


#5

Why can't we use any other names???
Also the error occurs if am trying to add another property.


#6

you can add another property in same way as earlier :slight_smile:
$scope.hello='m another property';


#7

This AngularJS course isn’t written well at all.

In the controller, attach promo to $scope, and set its value to your own string.

It should probably say, “In MainController.js, type…”

It’s too bad I don’t understand the rest of the instructions, else I could translate it into simpler English.