-
Notifications
You must be signed in to change notification settings - Fork 248
feat(component): Support expressions and mapping to controllers #61
Conversation
@@ -297,6 +298,7 @@ class _ComponentFactory { | |||
if (directive.$publishAs != null) { | |||
shadowScope[directive.$publishAs] = controller; | |||
} | |||
createAttributeMapping(scope, shadowScope, controller, parser); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This move would break #45
There's a test for that https://github.com/angular/angular.dart/blob/master/test/compiler_spec.dart#L294
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately that is not possible. We can't assign until controller is
constructed. That means that it is not possible to have everything assigned
before the constructor runs.
As much as I don't like it, I think we should optionally have init method
an the controller which would get called once all of the assignment is
done. What do you think about that?
On Tue, Jul 30, 2013 at 8:45 PM, Pavel Jbanov [email protected]:
In lib/block.dart:
@@ -297,6 +298,7 @@ class _ComponentFactory {
if (directive.$publishAs != null) {
shadowScope[directive.$publishAs] = controller;
}
- createAttributeMapping(scope, shadowScope, controller, parser);
—
Reply to this email directly or view it on GitHubhttps://github.com//pull/61/files#r5495279
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it has crossed my mind again just now. We already have TemplateLoader which is an attempt to work around same problem. Maybe having an "init" method will make the whole component lifecycle a bit easier to work with.
@NgComponent( template: r'<content></content>', publishAs: 'ctrl', map: const { 'attr': '@ctrl.attr', 'expr': '=ctrl.expr', 'ondone': '&ctrl.onDone', 'onOptional': '&ctrl.onOptional' } ) class IoControllerComponent { Scope scope; var attr; var expr; var onDone; var onOptional; IoControllerComponent(Scope scope) { this.scope = scope; scope.$root.ioComponent = this; } }
MERGED |
No description provided.