diff options
| author | Eduardo Garcia | 2013-05-21 16:40:48 -0500 |
|---|---|---|
| committer | Pete Bacon Darwin | 2013-06-04 20:07:09 +0100 |
| commit | 8dd23ad2f2cc0223f08eb8a21aad10f5e7a3f6fb (patch) | |
| tree | 121b6b950786aedf6997bfd9cdf15edc1fc4ba74 /docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc | |
| parent | bce75d7c68e8a9151045efb035b047a05f930dc6 (diff) | |
| download | angular.js-8dd23ad2f2cc0223f08eb8a21aad10f5e7a3f6fb.tar.bz2 | |
docs(guide): format snippets of code in plain text
Diffstat (limited to 'docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc')
| -rw-r--r-- | docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc b/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc index 47d59427..e3a570d4 100644 --- a/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc +++ b/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc @@ -21,9 +21,11 @@ constructor). Constructors are always applied to an existing scope object. You set up the initial state of a scope by creating model properties. For example: -function GreetingCtrl($scope) { - $scope.greeting = 'Hola!'; -} +<pre> + function GreetingCtrl($scope) { + $scope.greeting = 'Hola!'; + } +</pre> The `GreetingCtrl` controller creates a `greeting` model which can be referred to in a template. @@ -32,11 +34,13 @@ in the global scope. This is only for demonstration purposes - in a real application you should use the `.controller` method of your Angular module for your application as follows: -var myApp = angular.module('myApp',[]); +<pre> + var myApp = angular.module('myApp',[]); -myApp.controller('GreetingCtrl', ['$scope', function($scope) { - $scope.greeting = 'Hola!'; -}]); + myApp.controller('GreetingCtrl', ['$scope', function($scope) { + $scope.greeting = 'Hola!'; + }]); +</pre> Note also that we use the array notation to explicitly specify the dependency of the controller on the `$scope` service provided by Angular. |
