From 5a222244fb28023504875152c4affe93d2e489e4 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Thu, 3 Jul 2014 12:13:12 +0100 Subject: [PATCH] docs(guide/controller): tweak initial example --- docs/content/guide/controller.ngdoc | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/docs/content/guide/controller.ngdoc b/docs/content/guide/controller.ngdoc index abb0fa28..9a699436 100644 --- a/docs/content/guide/controller.ngdoc +++ b/docs/content/guide/controller.ngdoc @@ -37,12 +37,8 @@ The properties contain the **view model** (the model that will be presented by t `$scope` properties will be available to the template at the point in the DOM where the Controller is registered. -The following example demonstrates setting up -`GreetingController`, -which attaches a `greeting` property containing the string `'Hola!'` to the `$scope`: - -We attach the controller as a module on the application using the `.controller` method of your -{@link module Angular Module}. This keeps it out of the global scope. +The following example demonstrates creating a `GreetingController`, which attaches a `greeting` +property containing the string `'Hola!'` to the `$scope`: ```js var myApp = angular.module('myApp',[]); @@ -52,9 +48,18 @@ myApp.controller('GreetingController', ['$scope', function($scope) { }]); ``` +We create an {@link module Angular Module}, `myApp`, for our application. Then we add the controller's +constructor function to the module using the `.controller()` method. This keeps the controller's +constructor function out of the global scope. -Once the Controller has been attached to the DOM, the `greeting` property can be data-bound to the -template: +
+We have used an **inline injection annotation** to explicitly specify the dependency +of the Controller on the `$scope` service provided by Angular. See the guide on +{@link guide/di Dependency Injection} for more information. +
+ +We attach our controller to the DOM using the `ng-controller` directive. The `greeting` property can +now be data-bound to the template: ```js
@@ -63,12 +68,6 @@ template: ``` - -We have used an **inline injection annotation** to explicitly specify the dependency -of the Controller on the `$scope` service provided by Angular. See the guide on -[Dependency Injection](http://docs.angularjs.org/guide/di) for more information. - - # Adding Behavior to a Scope Object In order to react to events or execute computation in the view we must provide behavior to the