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

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

Issue 176943008: Update the Angular/DI tests to latest from github. (Closed) Base URL: https://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_include.dart
diff --git a/third_party/pkg/angular/lib/directive/ng_include.dart b/third_party/pkg/angular/lib/directive/ng_include.dart
index 62e8dd2934ef1b7daf3bcf2ef4e9795519a1f4c7..f0e35e0782a527e8396b098f0e4e15a2d056add7 100644
--- a/third_party/pkg/angular/lib/directive/ng_include.dart
+++ b/third_party/pkg/angular/lib/directive/ng_include.dart
@@ -17,26 +17,25 @@ part of angular.directive;
*/
@NgDirective(
selector: '[ng-include]',
- map: const {'ng-include': '@url'} )
+ map: const {'ng-include': '@url'})
class NgIncludeDirective {
- dom.Element element;
- Scope scope;
- BlockCache blockCache;
- Injector injector;
+ final dom.Element element;
+ final Scope scope;
+ final BlockCache blockCache;
+ final Injector injector;
+ final DirectiveMap directives;
Block _previousBlock;
Scope _previousScope;
- NgIncludeDirective(this.element, this.scope, this.blockCache, this.injector);
+ NgIncludeDirective(this.element, this.scope, this.blockCache, this.injector, this.directives);
_cleanUp() {
- if (_previousBlock == null) {
- return;
- }
+ if (_previousBlock == null) return;
_previousBlock.remove();
- _previousScope.$destroy();
+ _previousScope.destroy();
element.innerHtml = '';
_previousBlock = null;
@@ -45,8 +44,9 @@ class NgIncludeDirective {
_updateContent(createBlock) {
// create a new scope
- _previousScope = scope.$new();
- _previousBlock = createBlock(injector.createChild([new Module()..value(Scope, _previousScope)]));
+ _previousScope = scope.createChild(new PrototypeMap(scope.context));
+ _previousBlock = createBlock(injector.createChild([new Module()
+ ..value(Scope, _previousScope)]));
_previousBlock.elements.forEach((elm) => element.append(elm));
}
@@ -55,7 +55,7 @@ class NgIncludeDirective {
set url(value) {
_cleanUp();
if (value != null && value != '') {
- blockCache.fromUrl(value).then(_updateContent);
+ blockCache.fromUrl(value, directives).then(_updateContent);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698