-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test(ivy): add canonical lifecycle example #21793
Conversation
You can preview 3954c64 at https://pr21793-3954c64.ngbuilds.io/. |
You can preview 0135b3f at https://pr21793-0135b3f.ngbuilds.io/. |
|
||
@Component({selector: 'lifecycle-comp', template: ``}) | ||
class LifecycleComp { | ||
@Input() nameMin: string; |
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.
@Input('name')
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.
Good catch!
static ngComponentDef = r3.defineComponent({ | ||
type: LifecycleComp, | ||
tag: 'lifecycle-comp', | ||
factory: () => new LifecycleComp(), |
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.
factory: function LifecycleComp_Factory() { return new LifecycleComp(); },
This is optional (since this is non-normative) but would be more consistent.
type: LifecycleComp, | ||
tag: 'lifecycle-comp', | ||
factory: () => new LifecycleComp(), | ||
template: function(ctx: any, cm: boolean) {}, |
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.
template: function LifecycleComp_Template(ctx: LifecycleComp, cm: boolean) {}
This is optional (since this is non-normative) but would be more consistent.
name1 = '1'; | ||
name2 = '2'; | ||
|
||
static ngComponentDef = r3.defineComponent({ |
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.
Add // NORMATIVE
above this declaration
} | ||
}); | ||
} | ||
|
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.
Add \\ /NORMANTIVE
static ngComponentDef = r3.defineComponent({ | ||
type: SimpleLayout, | ||
tag: 'simple-layout', | ||
factory: () => new SimpleLayout(), |
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.
factory SimpleLayout_Factory() { return new SimpleLayout(); }
type: SimpleLayout, | ||
tag: 'simple-layout', | ||
factory: () => new SimpleLayout(), | ||
template: function(ctx: any, cm: boolean) { |
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.
function SimpleLayout_Template(ctx: SimpleLayout, cm: boolean) {
static ngComponentDef = r3.defineComponent({ | ||
type: SimpleLayout, | ||
tag: 'simple-layout', | ||
factory: () => simpleLayout = new SimpleLayout(), |
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.
factory: function SimpleLayout_Factory() { return new SimpleLayout(); }
type: SimpleLayout, | ||
tag: 'simple-layout', | ||
factory: () => simpleLayout = new SimpleLayout(), | ||
template: function(ctx: any, cm: boolean) { |
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.
template: function SimpleLayout_Template(ctx: SimpleLayout, cm: boolean) {
Implement the lifecycle pattern defined in angular#21793
Implement the lifecycle pattern defined in angular#21793
Implement the lifecycle pattern defined in angular#21793 PR Close angular#21865
Implement the lifecycle pattern defined in angular#21793 PR Close angular#21865
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Adds an example of lifecycle hooks to the canonical spec. Also flips
r()
calls for content children in lifecycle spec (it was left over from a previous implementation).cc @jelbourn