Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: third_party/pkg/angular/lib/directive/ng_if.dart

Issue 180843004: Revert revision 33053 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
- }
}
}
« no previous file with comments | « third_party/pkg/angular/lib/directive/ng_form.dart ('k') | third_party/pkg/angular/lib/directive/ng_include.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698