| 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);
|
| }
|
| }
|
|
|