Hi W,

If you put script's inside your page, you need to put it inside a script 
tag.  like this:

<!DOCTYPE html>
<html>
<script src=
"https://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.js";></script>
<body ng-app="app">

  <script>
    angular.module('app', []);
    angular.module('app').config(['$controllerProvider', function(
$controllerProvider) {
      $controllerProvider.allowGlobals();
    }]);
  </script>

  <!--
  <p ng-controller="EmptyController">
   commented out, because you must define a controller!
  </p>
   -->

  <script>
    function MessageController() {
      this.message = "This is a model.";
    }
  </script>

  <p ng-controller="MessageController as controller">
    {{controller.message}}
  </p>


</body>
</html>


The samples that are in the page, are live-editable! So if you want to play 
with them, you can edit them in the book itself. (The book mentions that 
the JS parts are in separately loaded JS files, but glosses a bit over it 
really)
As a side note, while you are still learning, don't use global controllers 
like that. I did read a small part of the book, and it seems to be a bit 
outdated, while it's not wrong what is in there, quite a couple of things 
in there are now looked upon a tad different. If you are done with this 
book, you really want to read the styleguide 
<https://github.com/johnpapa/angular-styleguide>. 

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to