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

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

Issue 180873006: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Review feedback 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
diff --git a/third_party/pkg/angular/lib/directive/ng_switch.dart b/third_party/pkg/angular/lib/directive/ng_switch.dart
index e0e65d477944a332c4be8b6995c547bbe5f986c1..a66d5c4043f85642e1038454278f81fd476d84f0 100644
--- a/third_party/pkg/angular/lib/directive/ng_switch.dart
+++ b/third_party/pkg/angular/lib/directive/ng_switch.dart
@@ -55,13 +55,12 @@ part of angular.directive;
'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;
- Scope scope;
+ final Scope scope;
NgSwitchDirective(this.scope) {
cases['?'] = <_Case>[];
@@ -74,18 +73,17 @@ class NgSwitchDirective {
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.$new();
- var block = caze.blockFactory(childScope)
- ..insertAfter(caze.anchor);
+ Scope childScope = scope.createChild(new PrototypeMap(scope.context));
+ var block = caze.blockFactory(childScope)..insertAfter(caze.anchor);
currentBlocks.add(new _BlockScopePair(block, childScope));
});
if (onChange != null) {
@@ -111,10 +109,7 @@ class _Case {
@NgDirective(
selector: '[ng-switch-when]',
children: NgAnnotation.TRANSCLUDE_CHILDREN,
- map: const {
- '.': '@value'
- }
-)
+ map: const {'.': '@value'})
class NgSwitchWhenDirective {
final NgSwitchDirective ngSwitch;
final BlockHole hole;
@@ -123,19 +118,17 @@ class NgSwitchWhenDirective {
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