एंगुलरजेएस में स्कोप या स्कोप को समझना

कोणीय में, बच्चे का दायरा आमतौर पर मूलरूप से मूलरूप से विरासत में मिला होता है। एकमात्र अपवाद निर्देश है, जो scope: { ... } का उपयोग करता scope: { ... } , जो एक "पृथक" गुंजाइश बनाता है, जो प्रोटोटाइपिक रूप से विरासत में नहीं मिला है। पुन: प्रयोज्य घटकों के लिए निर्देशन बनाते समय इस डिज़ाइन का अक्सर उपयोग किया जाता है।

डोमेन का इनहेरिटेंस आमतौर पर प्रत्यक्ष होता है, और अक्सर आपको यह जानने की आवश्यकता भी नहीं होती है कि यह कैसे किया जाता है ... जब तक आप दो तरफा डेटा बाइंडिंग (यानी, तत्व, एनजी-मॉडल) से आदिम (जैसे, संख्या, स्ट्रिंग, तार्किक प्रकार) तक नहीं आते हैं ) बच्चे से माता-पिता के दायरे में परिभाषित किया गया है। यह काम नहीं करता है जैसा कि ज्यादातर लोग उम्मीद करते हैं। ऐसा होता है कि वंशज अपना स्वयं का दायरा बनाता है, जो उसी नाम की मूल संपत्ति को ओवरलैप करता है। यह कोणीय की विशेषता नहीं है, इसलिए प्रोटोटाइप जावास्क्रिप्ट में काम करता है। कोणीय के साथ काम करने वाले नए डेवलपर्स अक्सर महसूस नहीं करते हैं कि एनजी-रिपीट, एनजी-स्विच, एनजी-व्यू और एनजी-शामिल नए बच्चे क्षेत्र बनाते हैं, इसलिए इन निर्देशों का उपयोग करते समय समस्या प्रकट होती है।

" सर्वोत्तम प्रथाओं " का पालन करके इस समस्या से आसानी से बचा जा सकता है, जो कहती है कि एनजी-मॉडल में अभिव्यक्ति में हमेशा एक अवधि होनी चाहिए।

डॉट “।” मॉडल में यह सुनिश्चित करता है कि प्रोटोटाइप वंशानुक्रम उसी तरह काम करता है जैसा उसे होना चाहिए। इसलिये

.

/ , :

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


, , .

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

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

छवि

( , , 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 .

छवि

, :

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

छवि

, :

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

छवि

:

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

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

छवि


:

, : 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 , .

छवि

(, «77») , myPrimitive , .

, , .

छवि

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

छवि

: , «99» 11, 50.

$parent, :

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

छवि

( ), 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:

छवि

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

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

छवि

( .)

, . , , .

. 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"

छवि

: 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

छवि


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, :

    छवि

    ( , , 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 .

    छवि

    , :

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

    छवि

    , :

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

    छवि

    :

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

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

    छवि


    :

    , : 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 , .

    छवि

    (, «77») , myPrimitive , .

    , , .

    छवि

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

    छवि

    : , «99» 11, 50.

    $parent, :

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

    छवि

    ( ), 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:

    छवि

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

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

    छवि

    ( .)

    , . , , .

    . 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"

    छवि

    : 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

    छवि


    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, :

    छवि

    ( , , 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 .

    छवि

    , :

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

    छवि

    , :

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

    छवि

    :

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

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

    छवि


    :

    , : 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 , .

    छवि

    (, «77») , myPrimitive , .

    , , .

    छवि

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

    छवि

    : , «99» 11, 50.

    $parent, :

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

    छवि

    ( ), 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:

    छवि

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

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

    छवि

    ( .)

    , . , , .

    . 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"

    छवि

    : 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

    छवि


    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, :

    छवि

    ( , , 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 .

    छवि

    , :

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

    छवि

    , :

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

    छवि

    :

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

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

    छवि


    :

    , : 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 , .

    छवि

    (, «77») , myPrimitive , .

    , , .

    छवि

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

    छवि

    : , «99» 11, 50.

    $parent, :

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

    छवि

    ( ), 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:

    छवि

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

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

    छवि

    ( .)

    , . , , .

    . 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"

    छवि

    : 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

    छवि


    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, :

    छवि

    ( , , 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 .

    छवि

    , :

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

    छवि

    , :

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

    छवि

    :

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

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

    छवि


    :

    , : 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 , .

    छवि

    (, «77») , myPrimitive , .

    , , .

    छवि

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

    छवि

    : , «99» 11, 50.

    $parent, :

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

    छवि

    ( ), 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:

    छवि

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

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

    छवि

    ( .)

    , . , , .

    . 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"

    छवि

    : 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

    छवि


    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, :

    छवि

    ( , , 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 .

    छवि

    , :

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

    छवि

    , :

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

    छवि

    :

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

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

    छवि


    :

    , : 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 , .

    छवि

    (, «77») , myPrimitive , .

    , , .

    छवि

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

    छवि

    : , «99» 11, 50.

    $parent, :

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

    छवि

    ( ), 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:

    छवि

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

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

    छवि

    ( .)

    , . , , .

    . 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"

    छवि

    : 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

    छवि


    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, :

      छवि

      ( , , 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 .

      छवि

      , :

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

      छवि

      , :

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

      छवि

      :

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

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

      छवि


      :

      , : 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 , .

      छवि

      (, «77») , myPrimitive , .

      , , .

      छवि

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

      छवि

      : , «99» 11, 50.

      $parent, :

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

      छवि

      ( ), 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:

      छवि

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

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

      छवि

      ( .)

      , . , , .

      . 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"

      छवि

      : 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

      छवि


      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, :

      छवि

      ( , , 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 .

      छवि

      , :

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

      छवि

      , :

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

      छवि

      :

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

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

      छवि


      :

      , : 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 , .

      छवि

      (, «77») , myPrimitive , .

      , , .

      छवि

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

      छवि

      : , «99» 11, 50.

      $parent, :

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

      छवि

      ( ), 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:

      छवि

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

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

      छवि

      ( .)

      , . , , .

      . 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"

      छवि

      : 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

      छवि


      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, :

      छवि

      ( , , 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 .

      छवि

      , :

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

      छवि

      , :

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

      छवि

      :

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

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

      छवि


      :

      , : 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 , .

      छवि

      (, «77») , myPrimitive , .

      , , .

      छवि

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

      छवि

      : , «99» 11, 50.

      $parent, :

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

      छवि

      ( ), 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:

      छवि

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

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

      छवि

      ( .)

      , . , , .

      . 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"

      छवि

      : 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

      छवि


      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, :

      छवि

      ( , , 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 .

      छवि

      , :

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

      छवि

      , :

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

      छवि

      :

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

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

      छवि


      :

      , : 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 , .

      छवि

      (, «77») , myPrimitive , .

      , , .

      छवि

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

      छवि

      : , «99» 11, 50.

      $parent, :

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

      छवि

      ( ), 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:

      छवि

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

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

      छवि

      ( .)

      , . , , .

      . 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"

      छवि

      : 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

      छवि


      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, :

    छवि

    ( , , 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 .

    छवि

    , :

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

    छवि

    , :

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

    छवि

    :

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

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

    छवि


    :

    , : 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 , .

    छवि

    (, «77») , myPrimitive , .

    , , .

    छवि

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

    छवि

    : , «99» 11, 50.

    $parent, :

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

    छवि

    ( ), 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:

    छवि

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

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

    छवि

    ( .)

    , . , , .

    . 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"

    छवि

    : 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

    छवि


    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/In182670/


All Articles