| Index: third_party/pkg/angular/lib/directive/ng_if.dart
|
| ===================================================================
|
| --- third_party/pkg/angular/lib/directive/ng_if.dart (revision 33054)
|
| +++ third_party/pkg/angular/lib/directive/ng_if.dart (working copy)
|
| @@ -14,34 +14,27 @@
|
| * The new child scope. This child scope is recreated whenever the `ng-if`
|
| * subtree is inserted into the DOM and destroyed when it's removed from the
|
| * DOM. Refer
|
| - * https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-prototypical-Inheritance prototypical inheritance
|
| + * https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance prototypal inheritance
|
| */
|
| Scope _childScope;
|
|
|
| - _NgUnlessIfAttrDirectiveBase(this._boundBlockFactory, this._blockHole,
|
| - this._scope);
|
| + _NgUnlessIfAttrDirectiveBase(this._boundBlockFactory, this._blockHole, this._scope);
|
|
|
| // Override in subclass.
|
| set condition(value);
|
|
|
| void _ensureBlockExists() {
|
| if (_block == null) {
|
| - _childScope = _scope.createChild(new PrototypeMap(_scope.context));
|
| + _childScope = _scope.$new();
|
| _block = _boundBlockFactory(_childScope);
|
| - var insertBlock = _block;
|
| - _scope.rootScope.domWrite(() {
|
| - insertBlock.insertAfter(_blockHole);
|
| - });
|
| + _block.insertAfter(_blockHole);
|
| }
|
| }
|
|
|
| void _ensureBlockDestroyed() {
|
| if (_block != null) {
|
| - var removeBlock = _block;
|
| - _scope.rootScope.domWrite(() {
|
| - removeBlock.remove();
|
| - });
|
| - _childScope.destroy();
|
| + _block.remove();
|
| + _childScope.$destroy();
|
| _block = null;
|
| _childScope = null;
|
| }
|
| @@ -63,7 +56,7 @@
|
| * Whenever the subtree is inserted into the DOM, it always gets a new child
|
| * scope. This child scope is destroyed when the subtree is removed from the
|
| * DOM. Refer
|
| - * https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-prototypical-Inheritance prototypical inheritance
|
| + * https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance prototypal inheritance
|
| *
|
| * This has an important implication when `ng-model` is used inside an `ng-if`
|
| * to bind to a javascript primitive defined in the parent scope. In such a
|
| @@ -95,15 +88,14 @@
|
| map: const {'.': '=>condition'})
|
| class NgIfDirective extends _NgUnlessIfAttrDirectiveBase {
|
| NgIfDirective(BoundBlockFactory boundBlockFactory,
|
| - BlockHole blockHole,
|
| - Scope scope): super(boundBlockFactory, blockHole, scope);
|
| + BlockHole blockHole,
|
| + Scope scope): super(boundBlockFactory, blockHole, scope);
|
|
|
| set condition(value) {
|
| - if (toBool(value)) {
|
| - _ensureBlockExists();
|
| - } else {
|
| - _ensureBlockDestroyed();
|
| - }
|
| + if (toBool(value))
|
| + _ensureBlockExists();
|
| + else
|
| + _ensureBlockDestroyed();
|
| }
|
| }
|
|
|
| @@ -123,7 +115,7 @@
|
| * Whenever the subtree is inserted into the DOM, it always gets a new child
|
| * scope. This child scope is destroyed when the subtree is removed from the
|
| * DOM. Refer
|
| - * https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-prototypical-Inheritance prototypical inheritance
|
| + * https://github.com/angular/angular.js/wiki/The-Nuances-of-Scope-Prototypal-Inheritance prototypal inheritance
|
| *
|
| * This has an important implication when `ng-model` is used inside an
|
| * `ng-unless` to bind to a javascript primitive defined in the parent scope.
|
| @@ -157,14 +149,13 @@
|
| class NgUnlessDirective extends _NgUnlessIfAttrDirectiveBase {
|
|
|
| NgUnlessDirective(BoundBlockFactory boundBlockFactory,
|
| - BlockHole blockHole,
|
| - Scope scope): super(boundBlockFactory, blockHole, scope);
|
| + BlockHole blockHole,
|
| + Scope scope): super(boundBlockFactory, blockHole, scope);
|
|
|
| set condition(value) {
|
| - if (!toBool(value)) {
|
| + if (!toBool(value))
|
| _ensureBlockExists();
|
| - } else {
|
| + else
|
| _ensureBlockDestroyed();
|
| - }
|
| }
|
| }
|
|
|