fix(compiler): use DI order for change detection order.

Closes #8198
This commit is contained in:
Tobias Bosch
2016-04-25 08:39:53 -07:00
parent 152a117d5c
commit 67d05eb65f
4 changed files with 78 additions and 6 deletions

View File

@ -109,7 +109,7 @@ export class ProviderElementContext {
var sortedProviderTypes =
this._transformedProviders.values().map(provider => provider.token.identifier);
var sortedDirectives = ListWrapper.clone(this._directiveAsts);
ListWrapper.sort(this._directiveAsts,
ListWrapper.sort(sortedDirectives,
(dir1, dir2) => sortedProviderTypes.indexOf(dir1.directive.type) -
sortedProviderTypes.indexOf(dir2.directive.type));
return sortedDirectives;

View File

@ -118,9 +118,13 @@ export class ElementAst implements TemplateAst {
* Get the component associated with this element, if any.
*/
getComponent(): CompileDirectiveMetadata {
return this.directives.length > 0 && this.directives[0].directive.isComponent ?
this.directives[0].directive :
null;
for (var i = 0; i < this.directives.length; i++) {
var dirAst = this.directives[i];
if (dirAst.directive.isComponent) {
return dirAst.directive;
}
}
return null;
}
}