From fc060dfc08f048511fe78e9df04ce4616171da34 Mon Sep 17 00:00:00 2001 From: Tobias Bosch Date: Tue, 5 Nov 2013 22:16:11 -0800 Subject: docs(guide/overview): Refactor overview and mvc docs Before, there we multiple overview docs: - guide/overview - guide/introduction - guide/dev_guide.mvc - guide/dev_guide.mvc.understanding_model - guide/dev_guide.mvc.understanding_view - guide/concepts Now we have: - guide/introduction: High level description of Angular with the key benefits but without code or any concrete concepts - guide/concepts: explains all important concepts with a simple example and contains deep links to the other parts of the guide. All the old information was moved into existing documents or deleted when they were duplicates. --- docs/content/guide/scope.ngdoc | 127 +++++++++++++++++++++++++++++++---------- 1 file changed, 98 insertions(+), 29 deletions(-) (limited to 'docs/content/guide/scope.ngdoc') diff --git a/docs/content/guide/scope.ngdoc b/docs/content/guide/scope.ngdoc index 629d3782..342877d7 100644 --- a/docs/content/guide/scope.ngdoc +++ b/docs/content/guide/scope.ngdoc @@ -110,46 +110,46 @@ new child scopes (refer to directive documentation to see which directives creat When new scopes are created, they are added as children of their parent scope. This creates a tree structure which parallels the DOM where they're attached -When Angular evaluates `{{username}}`, it first looks at the scope associated with the given -element for the `username` property. If no such property is found, it searches the parent scope +When Angular evaluates `{{name}}`, it first looks at the scope associated with the given +element for the `name` property. If no such property is found, it searches the parent scope and so on until the root scope is reached. In JavaScript this behavior is known as prototypical inheritance, and child scopes prototypically inherit from their parents. -This example illustrates scopes in application, and prototypical inheritance of properties. +This example illustrates scopes in application, and prototypical inheritance of properties. The example is followed by +a diagram depicting the scope boundaries. +
- - /* remove .doc-example-live in jsfiddle */ - .doc-example-live .ng-scope { - border: 1px dashed red; - } + +
+ Hello {{name}}! +
+
+
    +
  1. {{name}}
  2. +
+
- function EmployeeController($scope) { - $scope.department = 'Engineering'; - $scope.employee = { - name: 'Joe the Manager', - reports: [ - {name: 'John Smith'}, - {name: 'Mary Run'} - ] - }; + function GreetCtrl($scope) { + $scope.name = 'World'; + } + + function ListCtrl($scope) { + $scope.names = ['Igor', 'Misko', 'Vojta']; } - -
- Manager: {{employee.name}} [ {{department}} ]
- Reports: -
    -
  • - {{employee.name}} [ {{department}} ] -
  • -
-
- {{greeting}} -
+ + .show-scope .doc-example-live.ng-scope, + .show-scope .doc-example-live .ng-scope { + border: 1px solid red; + margin: 3px; + }
+
+ + Notice that Angular automatically places `ng-scope` class on elements where scopes are attached. The `