📜 ⬆️ ⬇️

Understanding scope or Scope in AngularJS

In Angulyar, a child scope is typically prototypically inherited from the parent. The only exception is a directive in which scope: { ... } is used scope: { ... } , which creates an “isolated” scope that is not inherited prototype. This design is often used to create guidelines for reusable components.

Inheritance of areas is usually direct, and often you don’t even need to know how it is done ... until you encounter two-way data binding (i.e. form elements, ng-model) to primitives (eg, number, string, logical type ), defined in the parent scope of the child. It does not work like most people expect. It happens so that the descendant creates its own scope, which overlaps the parent property with the same name. This is not a feature of Angulyar, as the prototype inheritance works in Javascript. New developers working with Angulyar often do not understand that ng-repeat, ng-switch, ng-view and ng-include create new child regions, so the problem arises when using these directives.

This problem is easily avoided by following the " best practices ", which says that the expression in the ng-model should always contain a period.
')
The dot "." In the model ensures that prototype inheritance works as expected. therefore

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.


.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.


.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.


.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.


.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.
   
.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

.

/ , :

1. $parent.parentScopeProperty
. .
2. , , ( )


, , .

parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

image

( , , anArray , .)

, parentScope, , , , , . ( parentScope, ... ). , :

childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
, :

childScope.aString = 'child string'
, aString childScope. parentScope . , ng-repeat ng-include .

image

, :

childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
, (anArray anObject) childScope. parentScope, . childScope; . (, .)

image

, :

childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
, , parentScope .

image

:

childScope.propertyX childScope propertyX, . childScope.propertyX, .
:

delete childScope.anArray childScope.anArray[1] === 22 // true
childScope, , , .

image


:

, : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
, , , .. scope: false .

ng-include
, :

$scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
HTML:

<script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
ng-include , .

image

(, «77») , myPrimitive , .

, , .

image

(, «99») . tpl2.html , , ngModel MyObject — .

image

: , «99» 11, 50.

$parent, :

<input ng-model="$parent.myPrimitive">
(, «22») . ( $parent ,
).

image

( ), Angular - (. . ), $parent, $$childHead $$childTail . .

, , . , , . ,

// $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
, « ». ( Stack Overflow .)

. stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

ng-switch
ng-switch ng-include. , $parent , . .

. AngularJS, bind scope of a switch-case?

ng-repeat
ng-repeat -. , :

$scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
HTML:

<ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
/, ng-repeat , , . ( .) ng-repeat:

childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

image

ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

, ( ) . (. ., num , ng-model) . ng-repeat , :

image

( .)

, . , , .

. ng-model, ng-repeat, inputs ng-repeat and databinding

ng-view
, , , ng-include.

ng-controller
( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

( , . . . Controller load order differs when loading or navigating )


( scope: false ) — , . , , , , , , . , .

scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

scope: { ... } — . . , , . . . , .

- ( «=») ( «@») . «&» . , , . ,
— -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

__proto__ Scope ( , «Scope» «Object»). $parent , , , .



<my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

, : scope.someIsolateProp = "I'm isolated"

image

: attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

( ) — $parent . , $$nextSibling .

. AngularJS two way binding not working in directive with transcluded scope

, : transclude: true

image


showScope() . .


:

— ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
( ), - (. . ), $parent, $$childHead $$childTail.

  1. .

    / , :

    1. $parent.parentScopeProperty
    . .
    2. , , ( )


    , , .

    parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

    image

    ( , , anArray , .)

    , parentScope, , , , , . ( parentScope, ... ). , :

    childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
    , :

    childScope.aString = 'child string'
    , aString childScope. parentScope . , ng-repeat ng-include .

    image

    , :

    childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
    , (anArray anObject) childScope. parentScope, . childScope; . (, .)

    image

    , :

    childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
    , , parentScope .

    image

    :

    childScope.propertyX childScope propertyX, . childScope.propertyX, .
    :

    delete childScope.anArray childScope.anArray[1] === 22 // true
    childScope, , , .

    image


    :

    , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
    , , , .. scope: false .

    ng-include
    , :

    $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
    HTML:

    <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
    ng-include , .

    image

    (, «77») , myPrimitive , .

    , , .

    image

    (, «99») . tpl2.html , , ngModel MyObject — .

    image

    : , «99» 11, 50.

    $parent, :

    <input ng-model="$parent.myPrimitive">
    (, «22») . ( $parent ,
    ).

    image

    ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

    , , . , , . ,

    // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
    , « ». ( Stack Overflow .)

    . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

    ng-switch
    ng-switch ng-include. , $parent , . .

    . AngularJS, bind scope of a switch-case?

    ng-repeat
    ng-repeat -. , :

    $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
    HTML:

    <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
    /, ng-repeat , , . ( .) ng-repeat:

    childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
    ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

    image

    ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

    , ( ) . (. ., num , ng-model) . ng-repeat , :

    image

    ( .)

    , . , , .

    . ng-model, ng-repeat, inputs ng-repeat and databinding

    ng-view
    , , , ng-include.

    ng-controller
    ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

    ( , . . . Controller load order differs when loading or navigating )


    ( scope: false ) — , . , , , , , , . , .

    scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

    scope: { ... } — . . , , . . . , .

    - ( «=») ( «@») . «&» . , , . ,
    — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

    __proto__ Scope ( , «Scope» «Object»). $parent , , , .



    <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

    scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

    , : scope.someIsolateProp = "I'm isolated"

    image

    : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

    onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


    transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

    ( ) — $parent . , $$nextSibling .

    . AngularJS two way binding not working in directive with transcluded scope

    , : transclude: true

    image


    showScope() . .


    :

    — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
    ( ), - (. . ), $parent, $$childHead $$childTail.

  2. .

    / , :

    1. $parent.parentScopeProperty
    . .
    2. , , ( )


    , , .

    parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

    image

    ( , , anArray , .)

    , parentScope, , , , , . ( parentScope, ... ). , :

    childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
    , :

    childScope.aString = 'child string'
    , aString childScope. parentScope . , ng-repeat ng-include .

    image

    , :

    childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
    , (anArray anObject) childScope. parentScope, . childScope; . (, .)

    image

    , :

    childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
    , , parentScope .

    image

    :

    childScope.propertyX childScope propertyX, . childScope.propertyX, .
    :

    delete childScope.anArray childScope.anArray[1] === 22 // true
    childScope, , , .

    image


    :

    , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
    , , , .. scope: false .

    ng-include
    , :

    $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
    HTML:

    <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
    ng-include , .

    image

    (, «77») , myPrimitive , .

    , , .

    image

    (, «99») . tpl2.html , , ngModel MyObject — .

    image

    : , «99» 11, 50.

    $parent, :

    <input ng-model="$parent.myPrimitive">
    (, «22») . ( $parent ,
    ).

    image

    ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

    , , . , , . ,

    // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
    , « ». ( Stack Overflow .)

    . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

    ng-switch
    ng-switch ng-include. , $parent , . .

    . AngularJS, bind scope of a switch-case?

    ng-repeat
    ng-repeat -. , :

    $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
    HTML:

    <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
    /, ng-repeat , , . ( .) ng-repeat:

    childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
    ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

    image

    ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

    , ( ) . (. ., num , ng-model) . ng-repeat , :

    image

    ( .)

    , . , , .

    . ng-model, ng-repeat, inputs ng-repeat and databinding

    ng-view
    , , , ng-include.

    ng-controller
    ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

    ( , . . . Controller load order differs when loading or navigating )


    ( scope: false ) — , . , , , , , , . , .

    scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

    scope: { ... } — . . , , . . . , .

    - ( «=») ( «@») . «&» . , , . ,
    — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

    __proto__ Scope ( , «Scope» «Object»). $parent , , , .



    <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

    scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

    , : scope.someIsolateProp = "I'm isolated"

    image

    : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

    onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


    transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

    ( ) — $parent . , $$nextSibling .

    . AngularJS two way binding not working in directive with transcluded scope

    , : transclude: true

    image


    showScope() . .


    :

    — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
    ( ), - (. . ), $parent, $$childHead $$childTail.

  3. .

    / , :

    1. $parent.parentScopeProperty
    . .
    2. , , ( )


    , , .

    parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

    image

    ( , , anArray , .)

    , parentScope, , , , , . ( parentScope, ... ). , :

    childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
    , :

    childScope.aString = 'child string'
    , aString childScope. parentScope . , ng-repeat ng-include .

    image

    , :

    childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
    , (anArray anObject) childScope. parentScope, . childScope; . (, .)

    image

    , :

    childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
    , , parentScope .

    image

    :

    childScope.propertyX childScope propertyX, . childScope.propertyX, .
    :

    delete childScope.anArray childScope.anArray[1] === 22 // true
    childScope, , , .

    image


    :

    , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
    , , , .. scope: false .

    ng-include
    , :

    $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
    HTML:

    <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
    ng-include , .

    image

    (, «77») , myPrimitive , .

    , , .

    image

    (, «99») . tpl2.html , , ngModel MyObject — .

    image

    : , «99» 11, 50.

    $parent, :

    <input ng-model="$parent.myPrimitive">
    (, «22») . ( $parent ,
    ).

    image

    ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

    , , . , , . ,

    // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
    , « ». ( Stack Overflow .)

    . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

    ng-switch
    ng-switch ng-include. , $parent , . .

    . AngularJS, bind scope of a switch-case?

    ng-repeat
    ng-repeat -. , :

    $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
    HTML:

    <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
    /, ng-repeat , , . ( .) ng-repeat:

    childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
    ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

    image

    ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

    , ( ) . (. ., num , ng-model) . ng-repeat , :

    image

    ( .)

    , . , , .

    . ng-model, ng-repeat, inputs ng-repeat and databinding

    ng-view
    , , , ng-include.

    ng-controller
    ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

    ( , . . . Controller load order differs when loading or navigating )


    ( scope: false ) — , . , , , , , , . , .

    scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

    scope: { ... } — . . , , . . . , .

    - ( «=») ( «@») . «&» . , , . ,
    — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

    __proto__ Scope ( , «Scope» «Object»). $parent , , , .



    <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

    scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

    , : scope.someIsolateProp = "I'm isolated"

    image

    : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

    onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


    transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

    ( ) — $parent . , $$nextSibling .

    . AngularJS two way binding not working in directive with transcluded scope

    , : transclude: true

    image


    showScope() . .


    :

    — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
    ( ), - (. . ), $parent, $$childHead $$childTail.

    .

    / , :

    1. $parent.parentScopeProperty
    . .
    2. , , ( )


    , , .

    parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

    image

    ( , , anArray , .)

    , parentScope, , , , , . ( parentScope, ... ). , :

    childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
    , :

    childScope.aString = 'child string'
    , aString childScope. parentScope . , ng-repeat ng-include .

    image

    , :

    childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
    , (anArray anObject) childScope. parentScope, . childScope; . (, .)

    image

    , :

    childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
    , , parentScope .

    image

    :

    childScope.propertyX childScope propertyX, . childScope.propertyX, .
    :

    delete childScope.anArray childScope.anArray[1] === 22 // true
    childScope, , , .

    image


    :

    , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
    , , , .. scope: false .

    ng-include
    , :

    $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
    HTML:

    <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
    ng-include , .

    image

    (, «77») , myPrimitive , .

    , , .

    image

    (, «99») . tpl2.html , , ngModel MyObject — .

    image

    : , «99» 11, 50.

    $parent, :

    <input ng-model="$parent.myPrimitive">
    (, «22») . ( $parent ,
    ).

    image

    ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

    , , . , , . ,

    // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
    , « ». ( Stack Overflow .)

    . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

    ng-switch
    ng-switch ng-include. , $parent , . .

    . AngularJS, bind scope of a switch-case?

    ng-repeat
    ng-repeat -. , :

    $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
    HTML:

    <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
    /, ng-repeat , , . ( .) ng-repeat:

    childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
    ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

    image

    ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

    , ( ) . (. ., num , ng-model) . ng-repeat , :

    image

    ( .)

    , . , , .

    . ng-model, ng-repeat, inputs ng-repeat and databinding

    ng-view
    , , , ng-include.

    ng-controller
    ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

    ( , . . . Controller load order differs when loading or navigating )


    ( scope: false ) — , . , , , , , , . , .

    scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

    scope: { ... } — . . , , . . . , .

    - ( «=») ( «@») . «&» . , , . ,
    — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

    __proto__ Scope ( , «Scope» «Object»). $parent , , , .



    <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

    scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

    , : scope.someIsolateProp = "I'm isolated"

    image

    : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

    onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


    transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

    ( ) — $parent . , $$nextSibling .

    . AngularJS two way binding not working in directive with transcluded scope

    , : transclude: true

    image


    showScope() . .


    :

    — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
    ( ), - (. . ), $parent, $$childHead $$childTail.

    .

    / , :

    1. $parent.parentScopeProperty
    . .
    2. , , ( )


    , , .

    parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

    image

    ( , , anArray , .)

    , parentScope, , , , , . ( parentScope, ... ). , :

    childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
    , :

    childScope.aString = 'child string'
    , aString childScope. parentScope . , ng-repeat ng-include .

    image

    , :

    childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
    , (anArray anObject) childScope. parentScope, . childScope; . (, .)

    image

    , :

    childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
    , , parentScope .

    image

    :

    childScope.propertyX childScope propertyX, . childScope.propertyX, .
    :

    delete childScope.anArray childScope.anArray[1] === 22 // true
    childScope, , , .

    image


    :

    , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
    , , , .. scope: false .

    ng-include
    , :

    $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
    HTML:

    <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
    ng-include , .

    image

    (, «77») , myPrimitive , .

    , , .

    image

    (, «99») . tpl2.html , , ngModel MyObject — .

    image

    : , «99» 11, 50.

    $parent, :

    <input ng-model="$parent.myPrimitive">
    (, «22») . ( $parent ,
    ).

    image

    ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

    , , . , , . ,

    // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
    , « ». ( Stack Overflow .)

    . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

    ng-switch
    ng-switch ng-include. , $parent , . .

    . AngularJS, bind scope of a switch-case?

    ng-repeat
    ng-repeat -. , :

    $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
    HTML:

    <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
    /, ng-repeat , , . ( .) ng-repeat:

    childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
    ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

    image

    ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

    , ( ) . (. ., num , ng-model) . ng-repeat , :

    image

    ( .)

    , . , , .

    . ng-model, ng-repeat, inputs ng-repeat and databinding

    ng-view
    , , , ng-include.

    ng-controller
    ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

    ( , . . . Controller load order differs when loading or navigating )


    ( scope: false ) — , . , , , , , , . , .

    scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

    scope: { ... } — . . , , . . . , .

    - ( «=») ( «@») . «&» . , , . ,
    — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

    __proto__ Scope ( , «Scope» «Object»). $parent , , , .



    <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

    scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

    , : scope.someIsolateProp = "I'm isolated"

    image

    : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

    onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


    transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

    ( ) — $parent . , $$nextSibling .

    . AngularJS two way binding not working in directive with transcluded scope

    , : transclude: true

    image


    showScope() . .


    :

    — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
    ( ), - (. . ), $parent, $$childHead $$childTail.

    1. .

      / , :

      1. $parent.parentScopeProperty
      . .
      2. , , ( )


      , , .

      parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

      image

      ( , , anArray , .)

      , parentScope, , , , , . ( parentScope, ... ). , :

      childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
      , :

      childScope.aString = 'child string'
      , aString childScope. parentScope . , ng-repeat ng-include .

      image

      , :

      childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
      , (anArray anObject) childScope. parentScope, . childScope; . (, .)

      image

      , :

      childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
      , , parentScope .

      image

      :

      childScope.propertyX childScope propertyX, . childScope.propertyX, .
      :

      delete childScope.anArray childScope.anArray[1] === 22 // true
      childScope, , , .

      image


      :

      , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
      , , , .. scope: false .

      ng-include
      , :

      $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
      HTML:

      <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
      ng-include , .

      image

      (, «77») , myPrimitive , .

      , , .

      image

      (, «99») . tpl2.html , , ngModel MyObject — .

      image

      : , «99» 11, 50.

      $parent, :

      <input ng-model="$parent.myPrimitive">
      (, «22») . ( $parent ,
      ).

      image

      ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

      , , . , , . ,

      // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
      , « ». ( Stack Overflow .)

      . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

      ng-switch
      ng-switch ng-include. , $parent , . .

      . AngularJS, bind scope of a switch-case?

      ng-repeat
      ng-repeat -. , :

      $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
      HTML:

      <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
      /, ng-repeat , , . ( .) ng-repeat:

      childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
      ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

      image

      ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

      , ( ) . (. ., num , ng-model) . ng-repeat , :

      image

      ( .)

      , . , , .

      . ng-model, ng-repeat, inputs ng-repeat and databinding

      ng-view
      , , , ng-include.

      ng-controller
      ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

      ( , . . . Controller load order differs when loading or navigating )


      ( scope: false ) — , . , , , , , , . , .

      scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

      scope: { ... } — . . , , . . . , .

      - ( «=») ( «@») . «&» . , , . ,
      — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

      __proto__ Scope ( , «Scope» «Object»). $parent , , , .



      <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

      scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

      , : scope.someIsolateProp = "I'm isolated"

      image

      : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

      onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


      transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

      ( ) — $parent . , $$nextSibling .

      . AngularJS two way binding not working in directive with transcluded scope

      , : transclude: true

      image


      showScope() . .


      :

      — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
      ( ), - (. . ), $parent, $$childHead $$childTail.

    2. .

      / , :

      1. $parent.parentScopeProperty
      . .
      2. , , ( )


      , , .

      parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

      image

      ( , , anArray , .)

      , parentScope, , , , , . ( parentScope, ... ). , :

      childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
      , :

      childScope.aString = 'child string'
      , aString childScope. parentScope . , ng-repeat ng-include .

      image

      , :

      childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
      , (anArray anObject) childScope. parentScope, . childScope; . (, .)

      image

      , :

      childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
      , , parentScope .

      image

      :

      childScope.propertyX childScope propertyX, . childScope.propertyX, .
      :

      delete childScope.anArray childScope.anArray[1] === 22 // true
      childScope, , , .

      image


      :

      , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
      , , , .. scope: false .

      ng-include
      , :

      $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
      HTML:

      <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
      ng-include , .

      image

      (, «77») , myPrimitive , .

      , , .

      image

      (, «99») . tpl2.html , , ngModel MyObject — .

      image

      : , «99» 11, 50.

      $parent, :

      <input ng-model="$parent.myPrimitive">
      (, «22») . ( $parent ,
      ).

      image

      ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

      , , . , , . ,

      // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
      , « ». ( Stack Overflow .)

      . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

      ng-switch
      ng-switch ng-include. , $parent , . .

      . AngularJS, bind scope of a switch-case?

      ng-repeat
      ng-repeat -. , :

      $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
      HTML:

      <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
      /, ng-repeat , , . ( .) ng-repeat:

      childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
      ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

      image

      ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

      , ( ) . (. ., num , ng-model) . ng-repeat , :

      image

      ( .)

      , . , , .

      . ng-model, ng-repeat, inputs ng-repeat and databinding

      ng-view
      , , , ng-include.

      ng-controller
      ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

      ( , . . . Controller load order differs when loading or navigating )


      ( scope: false ) — , . , , , , , , . , .

      scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

      scope: { ... } — . . , , . . . , .

      - ( «=») ( «@») . «&» . , , . ,
      — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

      __proto__ Scope ( , «Scope» «Object»). $parent , , , .



      <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

      scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

      , : scope.someIsolateProp = "I'm isolated"

      image

      : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

      onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


      transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

      ( ) — $parent . , $$nextSibling .

      . AngularJS two way binding not working in directive with transcluded scope

      , : transclude: true

      image


      showScope() . .


      :

      — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
      ( ), - (. . ), $parent, $$childHead $$childTail.

    3. .

      / , :

      1. $parent.parentScopeProperty
      . .
      2. , , ( )


      , , .

      parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

      image

      ( , , anArray , .)

      , parentScope, , , , , . ( parentScope, ... ). , :

      childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
      , :

      childScope.aString = 'child string'
      , aString childScope. parentScope . , ng-repeat ng-include .

      image

      , :

      childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
      , (anArray anObject) childScope. parentScope, . childScope; . (, .)

      image

      , :

      childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
      , , parentScope .

      image

      :

      childScope.propertyX childScope propertyX, . childScope.propertyX, .
      :

      delete childScope.anArray childScope.anArray[1] === 22 // true
      childScope, , , .

      image


      :

      , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
      , , , .. scope: false .

      ng-include
      , :

      $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
      HTML:

      <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
      ng-include , .

      image

      (, «77») , myPrimitive , .

      , , .

      image

      (, «99») . tpl2.html , , ngModel MyObject — .

      image

      : , «99» 11, 50.

      $parent, :

      <input ng-model="$parent.myPrimitive">
      (, «22») . ( $parent ,
      ).

      image

      ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

      , , . , , . ,

      // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
      , « ». ( Stack Overflow .)

      . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

      ng-switch
      ng-switch ng-include. , $parent , . .

      . AngularJS, bind scope of a switch-case?

      ng-repeat
      ng-repeat -. , :

      $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
      HTML:

      <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
      /, ng-repeat , , . ( .) ng-repeat:

      childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
      ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

      image

      ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

      , ( ) . (. ., num , ng-model) . ng-repeat , :

      image

      ( .)

      , . , , .

      . ng-model, ng-repeat, inputs ng-repeat and databinding

      ng-view
      , , , ng-include.

      ng-controller
      ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

      ( , . . . Controller load order differs when loading or navigating )


      ( scope: false ) — , . , , , , , , . , .

      scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

      scope: { ... } — . . , , . . . , .

      - ( «=») ( «@») . «&» . , , . ,
      — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

      __proto__ Scope ( , «Scope» «Object»). $parent , , , .



      <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

      scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

      , : scope.someIsolateProp = "I'm isolated"

      image

      : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

      onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


      transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

      ( ) — $parent . , $$nextSibling .

      . AngularJS two way binding not working in directive with transcluded scope

      , : transclude: true

      image


      showScope() . .


      :

      — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
      ( ), - (. . ), $parent, $$childHead $$childTail.

    4. .

      / , :

      1. $parent.parentScopeProperty
      . .
      2. , , ( )


      , , .

      parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

      image

      ( , , anArray , .)

      , parentScope, , , , , . ( parentScope, ... ). , :

      childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
      , :

      childScope.aString = 'child string'
      , aString childScope. parentScope . , ng-repeat ng-include .

      image

      , :

      childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
      , (anArray anObject) childScope. parentScope, . childScope; . (, .)

      image

      , :

      childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
      , , parentScope .

      image

      :

      childScope.propertyX childScope propertyX, . childScope.propertyX, .
      :

      delete childScope.anArray childScope.anArray[1] === 22 // true
      childScope, , , .

      image


      :

      , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
      , , , .. scope: false .

      ng-include
      , :

      $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
      HTML:

      <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
      ng-include , .

      image

      (, «77») , myPrimitive , .

      , , .

      image

      (, «99») . tpl2.html , , ngModel MyObject — .

      image

      : , «99» 11, 50.

      $parent, :

      <input ng-model="$parent.myPrimitive">
      (, «22») . ( $parent ,
      ).

      image

      ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

      , , . , , . ,

      // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
      , « ». ( Stack Overflow .)

      . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

      ng-switch
      ng-switch ng-include. , $parent , . .

      . AngularJS, bind scope of a switch-case?

      ng-repeat
      ng-repeat -. , :

      $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
      HTML:

      <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
      /, ng-repeat , , . ( .) ng-repeat:

      childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
      ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

      image

      ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

      , ( ) . (. ., num , ng-model) . ng-repeat , :

      image

      ( .)

      , . , , .

      . ng-model, ng-repeat, inputs ng-repeat and databinding

      ng-view
      , , , ng-include.

      ng-controller
      ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

      ( , . . . Controller load order differs when loading or navigating )


      ( scope: false ) — , . , , , , , , . , .

      scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

      scope: { ... } — . . , , . . . , .

      - ( «=») ( «@») . «&» . , , . ,
      — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

      __proto__ Scope ( , «Scope» «Object»). $parent , , , .



      <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

      scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

      , : scope.someIsolateProp = "I'm isolated"

      image

      : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

      onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


      transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

      ( ) — $parent . , $$nextSibling .

      . AngularJS two way binding not working in directive with transcluded scope

      , : transclude: true

      image


      showScope() . .


      :

      — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
      ( ), - (. . ), $parent, $$childHead $$childTail.

    .

    / , :

    1. $parent.parentScopeProperty
    . .
    2. , , ( )


    , , .

    parentScope aString, aNumber, anArray, anObject, aFunction. childScope parentScope, :

    image

    ( , , anArray , .)

    , parentScope, , , , , . ( parentScope, ... ). , :

    childScope.aString === 'parent string' childScope.anArray[1] === 20 childScope.anObject.property1 === 'parent prop1' childScope.aFunction() === 'parent output'
    , :

    childScope.aString = 'child string'
    , aString childScope. parentScope . , ng-repeat ng-include .

    image

    , :

    childScope.anArray[1] = '22' childScope.anObject.property1 = 'child prop1'
    , (anArray anObject) childScope. parentScope, . childScope; . (, .)

    image

    , :

    childScope.anArray = [100, 555] childScope.anObject = { name: 'Mark', country: 'USA' }
    , , parentScope .

    image

    :

    childScope.propertyX childScope propertyX, . childScope.propertyX, .
    :

    delete childScope.anArray childScope.anArray[1] === 22 // true
    childScope, , , .

    image


    :

    , : ng-repeat, ng-include, ng-switch, ng-view, ng-controller, scope: true , transclude: true . , : scope: { ... } . «» .
    , , , .. scope: false .

    ng-include
    , :

    $scope.myPrimitive = 50; $scope.myObject = {aNumber: 11};
    HTML:

    <script type="text/ng-template" id="/tpl1.html"> <input ng-model="myPrimitive"> </script> <div ng-include src="'/tpl1.html'"></div> <script type="text/ng-template" id="/tpl2.html"> <input ng-model="myObject.aNumber"> </script> <div ng-include src="'/tpl2.html'"></div>
    ng-include , .

    image

    (, «77») , myPrimitive , .

    , , .

    image

    (, «99») . tpl2.html , , ngModel MyObject — .

    image

    : , «99» 11, 50.

    $parent, :

    <input ng-model="$parent.myPrimitive">
    (, «22») . ( $parent ,
    ).

    image

    ( ), Angular - (. . ), $parent, $$childHead $$childTail . .

    , , . , , . ,

    // $scope.setMyPrimitive = function(value) { $scope.myPrimitive = value; }
    , « ». ( Stack Overflow .)

    . stackoverflow.com/a/13782671/215945 github.com/angular/angular.js/issues/1267 .

    ng-switch
    ng-switch ng-include. , $parent , . .

    . AngularJS, bind scope of a switch-case?

    ng-repeat
    ng-repeat -. , :

    $scope.myArrayOfPrimitives = [ 11, 22 ]; $scope.myArrayOfObjects = [{num: 101}, {num: 202}]
    HTML:

    <ul> <li ng-repeat="num in myArrayOfPrimitives"> <input ng-model="num"> </li> <ul> <ul> <li ng-repeat="obj in myArrayOfObjects"> <input ng-model="obj.num"> </li> <ul>
    /, ng-repeat , , . ( .) ng-repeat:

    childScope = scope.$new(); // ... childScope[valueIdent] = value; // childScope
    ( myArrayOfPrimitives), , . (. ., num , ng-model) . , ng-repeat , num , myArrayOfPrimitives:

    image

    ng-repeat ( ). Angular 1.0.2 , , , . Angular 1.0.3 +, . (. , .) , myArrayOfPrimitives, . , .

    , ( ) . (. ., num , ng-model) . ng-repeat , :

    image

    ( .)

    , . , , .

    . ng-model, ng-repeat, inputs ng-repeat and databinding

    ng-view
    , , , ng-include.

    ng-controller
    ( ng-controller) , ng-include ng-switch, . « $scope» — onehungrymind.com/angularjs-sticky-notes-pt-1-architecture . .

    ( , . . . Controller load order differs when loading or navigating )


    ( scope: false ) — , . , , , , , , . , .

    scope: true — , . ( DOM ) , . . . «» , ng-include ng-switch, .

    scope: { ... } — . . , , . . . , .

    - ( «=») ( «@») . «&» . , , . ,
    — -, . , parentProp : {scope: localProp: '@parentProp' } . : scope: { localProp: '@theParentProp' } .

    __proto__ Scope ( , «Scope» «Object»). $parent , , , .



    <my-directive interpolated="{{parentProp1}}" twowayBinding="parentProp2">

    scope: { interpolatedProp: '@interpolated', twowayBindingProp: '=twowayBinding' }

    , : scope.someIsolateProp = "I'm isolated"

    image

    : attrs.$observe('attr_name', function(value) { ... } , «@». , — attrs.$observe('interpolated', function(value) { ... }value 11. ( scope.interpolatedProp . , scope.twowayBindingProp , . . «=».)

    onehungrymind.com/angularjs-sticky-notes-pt-2-isolated-scope


    transclude: true — «» , . , (. ., , ng-transclude) , $parent ,

    ( ) — $parent . , $$nextSibling .

    . AngularJS two way binding not working in directive with transcluded scope

    , : transclude: true

    image


    showScope() . .


    :

    — ng-include, ng-switch, ng-controller, scope: true — ng-repeat. ng-repeat , . — scope: {...} . , «=», «@», «&» . — transclude: true . , - .
    ( ), - (. . ), $parent, $$childHead $$childTail.

Source: https://habr.com/ru/post/182670/


All Articles