Skip to content

Commit 17c1324

Browse files
add some questions for @mhevery
1 parent da2bc2b commit 17c1324

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: modules/@angular/upgrade/src/aot/upgrade_component.ts

+4
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck {
5858
// We ask for the Angular 1 scope from the Angular 2 injector, since
5959
// we will put the new component scope onto the new injector for each component
6060
const $parentScope = injector.get($SCOPE);
61+
// QUESTION: should we create an isolated scope if the scope is only true
6162
this.$componentScope = $parentScope.$new(!!this.directive.scope);
6263

6364
const controllerType = this.directive.controller;
@@ -81,6 +82,7 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck {
8182
}
8283

8384
ngOnInit() {
85+
// QUESTION: why not just use $compile instead of reproducing parts of it
8486
if (!this.directive.bindToController && this.directive.controller) {
8587
this.buildController(this.directive.controller, this.$componentScope,
8688
this.$element, this.directive.controllerAs);
@@ -114,6 +116,7 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck {
114116
postLink(this.$componentScope, this.$element, attrs, linkController, transcludeFn);
115117
}
116118

119+
// QUESTION: in Angular 1 we only call $onInit if the bindingDestination is the controller
117120
if (this.bindingDestination.$onInit) {
118121
this.bindingDestination.$onInit();
119122
}
@@ -168,6 +171,7 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck {
168171
if (directive.terminal) this.notSupported('terminal');
169172
if (directive.compile) this.notSupported('compile');
170173
const link = directive.link;
174+
// QUESTION: why not support link.post?
171175
if (typeof link == 'object') {
172176
if ((<angular.IDirectivePrePost>link).post) this.notSupported('link.post');
173177
}

0 commit comments

Comments
 (0)