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

Unified Diff: third_party/pkg/angular/lib/directive/ng_switch.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_switch.dart
===================================================================
--- third_party/pkg/angular/lib/directive/ng_switch.dart (revision 33054)
+++ third_party/pkg/angular/lib/directive/ng_switch.dart (working copy)
@@ -55,12 +55,13 @@
'ng-switch': '=>value',
'change': '&onChange'
},
- visibility: NgDirective.DIRECT_CHILDREN_VISIBILITY)
+ visibility: NgDirective.DIRECT_CHILDREN_VISIBILITY
+)
class NgSwitchDirective {
Map<String, List<_Case>> cases = new Map<String, List<_Case>>();
List<_BlockScopePair> currentBlocks = <_BlockScopePair>[];
Function onChange;
- final Scope scope;
+ Scope scope;
NgSwitchDirective(this.scope) {
cases['?'] = <_Case>[];
@@ -73,17 +74,18 @@
set value(val) {
currentBlocks
- ..forEach((_BlockScopePair pair) {
- pair.block.remove();
- pair.scope.destroy();
- })
- ..clear();
+ ..forEach((_BlockScopePair pair) {
+ pair.block.remove();
+ pair.scope.$destroy();
+ })
+ ..clear();
val = '!$val';
(cases.containsKey(val) ? cases[val] : cases['?'])
.forEach((_Case caze) {
- Scope childScope = scope.createChild(new PrototypeMap(scope.context));
- var block = caze.blockFactory(childScope)..insertAfter(caze.anchor);
+ Scope childScope = scope.$new();
+ var block = caze.blockFactory(childScope)
+ ..insertAfter(caze.anchor);
currentBlocks.add(new _BlockScopePair(block, childScope));
});
if (onChange != null) {
@@ -109,7 +111,10 @@
@NgDirective(
selector: '[ng-switch-when]',
children: NgAnnotation.TRANSCLUDE_CHILDREN,
- map: const {'.': '@value'})
+ map: const {
+ '.': '@value'
+ }
+)
class NgSwitchWhenDirective {
final NgSwitchDirective ngSwitch;
final BlockHole hole;
@@ -118,17 +123,19 @@
NgSwitchWhenDirective(this.ngSwitch, this.hole, this.blockFactory, this.scope);
- set value(String value) => ngSwitch.addCase('!$value', hole, blockFactory);
+ set value(String value) =>
+ ngSwitch.addCase('!$value', hole, blockFactory);
}
@NgDirective(
children: NgAnnotation.TRANSCLUDE_CHILDREN,
- selector: '[ng-switch-default]')
+ selector: '[ng-switch-default]'
+)
class NgSwitchDefaultDirective {
NgSwitchDefaultDirective(NgSwitchDirective ngSwitch, BlockHole hole,
- BoundBlockFactory blockFactory, Scope scope) {
+ BoundBlockFactory blockFactory, Scope scope) {
ngSwitch.addCase('?', hole, blockFactory);
}
}
« no previous file with comments | « third_party/pkg/angular/lib/directive/ng_style.dart ('k') | third_party/pkg/angular/lib/directive/ng_template.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698