aboutsummaryrefslogtreecommitdiffstats
path: root/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc
diff options
context:
space:
mode:
authorMisko Hevery2012-03-13 19:36:09 -0700
committerMisko Hevery2012-03-13 19:36:09 -0700
commit8b8fdddc0b13f90dcc081b7d29a79f1452f2dd7b (patch)
treee35fc500e5f2f760b602dce7215ad7679ba35e28 /docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc
parentce4b630524fe15185ea248ed2344549632c446ff (diff)
downloadangular.js-8b8fdddc0b13f90dcc081b7d29a79f1452f2dd7b.tar.bz2
docs(links): corrected borken links
Diffstat (limited to 'docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc')
-rw-r--r--docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc34
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc b/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc
index c308e399..17928adc 100644
--- a/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc
+++ b/docs/content/guide/dev_guide.mvc.understanding_controller.ngdoc
@@ -42,8 +42,8 @@ template/view. This behavior interacts with and modifies the application model.
As discussed in the {@link dev_guide.mvc.understanding_model Model} section of this guide, any
objects (or primitives) assigned to the scope become model properties. Any functions assigned to
the scope, along with any prototype methods of the controller type, become functions available in
-the template/view, and can be invoked via angular expressions and `ng:` event handlers (e.g. {@link
-api/angular.module.ng.$compileProvider.directive.ng:click ng:click}). These controller methods are always evaluated within the
+the template/view, and can be invoked via angular expressions and `ng-` event handlers (e.g. {@link
+api/angular.module.ng.$compileProvider.directive.ng-click ng-click}). These controller methods are always evaluated within the
context of the angular scope object that the controller function was applied to (which means that
the `this` keyword of any controller method is always bound to the scope that the controller
augments). This is how the second task of adding behavior to the scope is accomplished.
@@ -65,8 +65,8 @@ Do not use controllers for:
manipulation—the presentation logic of an application—is well known for being hard to test.
Putting any presentation logic into controllers significantly affects testability of the business
logic. Angular offers {@link dev_guide.templates.databinding} for automatic DOM manipulation. If
-you have to perform your own manual DOM manipulation, encapsulate the presentation logic in {@link
-dev_guide.compiler.widgets widgets} and {@link dev_guide.compiler.directives directives}.
+you have to perform your own manual DOM manipulation, encapsulate the presentation logic in and
+{@link api/angular.module.ng.$compileProvider.directive directives}.
- Input formatting — Use {@link dev_guide.forms angular form widgets} instead.
- Output filtering — Use {@link dev_guide.templates.filters angular filters} instead.
- Run stateless or stateful code shared across controllers — Use {@link dev_guide.services angular
@@ -78,7 +78,7 @@ instances).
# Associating Controllers with Angular Scope Objects
You can associate controllers with scope objects explicitly via the {@link api/angular.module.ng.$rootScope.Scope#$new
-scope.$new} api or implicitly via the {@link api/angular.module.ng.$compileProvider.directive.ng:controller ng:controller
+scope.$new} api or implicitly via the {@link api/angular.module.ng.$compileProvider.directive.ng-controller ng-controller
directive} or {@link api/angular.module.ng.$route $route service}.
@@ -99,9 +99,9 @@ string "very". Depending on which button is clicked, the `spice` model is set to
## A Spicy Controller Example
<pre>
-<body ng:controller="SpicyCtrl">
- <button ng:click="chiliSpicy()">Chili</button>
- <button ng:click="jalapenoSpicy()">Jalapeño</button>
+<body ng-controller="SpicyCtrl">
+ <button ng-click="chiliSpicy()">Chili</button>
+ <button ng-click="jalapenoSpicy()">Jalapeño</button>
<p>The food is {{spice}} spicy!</p>
</body>
@@ -119,7 +119,7 @@ SpicyCtrl.prototype.jalapenoSpicy = function() {
Things to notice in the example above:
-- The `ng:controller` directive is used to (implicitly) create a scope for our template, and the
+- The `ng-controller` directive is used to (implicitly) create a scope for our template, and the
scope is augmented (managed) by the `SpicyCtrl` controller.
- `SpicyCtrl` is just a plain JavaScript function. As an (optional) naming convention the name
starts with capital letter and ends with "Ctrl" or "Controller".
@@ -137,10 +137,10 @@ previous example.
## Controller Method Arguments Example
<pre>
-<body ng:controller="SpicyCtrl">
- <input ng:model="customSpice" value="wasabi">
- <button ng:click="spicy('chili')">Chili</button>
- <button ng:click="spicy(customSpice)">Custom spice</button>
+<body ng-controller="SpicyCtrl">
+ <input ng-model="customSpice" value="wasabi">
+ <button ng-click="spicy('chili')">Chili</button>
+ <button ng-click="spicy(customSpice)">Custom spice</button>
<p>The food is {{spice}} spicy!</p>
</body>
@@ -164,11 +164,11 @@ Controller inheritance in angular is based on {@link api/angular.module.ng.$root
have a look at an example:
<pre>
-<body ng:controller="MainCtrl">
+<body ng-controller="MainCtrl">
<p>Good {{timeOfDay}}, {{name}}!</p>
- <div ng:controller="ChildCtrl">
+ <div ng-controller="ChildCtrl">
<p>Good {{timeOfDay}}, {{name}}!</p>
- <p ng:controller="BabyCtrl">Good {{timeOfDay}}, {{name}}!</p>
+ <p ng-controller="BabyCtrl">Good {{timeOfDay}}, {{name}}!</p>
</body>
function MainCtrl($scope) {
@@ -186,7 +186,7 @@ function BabyCtrl($scope) {
}
</pre>
-Notice how we nested three `ng:controller` directives in our template. This template construct will
+Notice how we nested three `ng-controller` directives in our template. This template construct will
result in 4 scopes being created for our view:
- The root scope