Noob: no lifecycle events firing

Started a new project with

npx makes aurelia test -s webpack,typescript,app-with-router

To learn about lifecycles, I add to each *.ts file in src/ (inside class):

constructor() {
       console.log('<class> constructor');
}
afterBind() {
       console.log('<class> afterBind');
}
afterAttach() {
       console.log('<class> afterAttach');
}

When I test using npm start, only the constructor logs show up. Why am I not getting the lifecycle events?

npx --version:
7.11.1

2 Likes

afterBind has been changed to bound
afterAttach has been changed to attached

Can you try again?

Also, where did you read the documentation related to these lifecycle names?

2 Likes

That worked–thanks!
https://hamedfathi.gitbook.io/aurelia2/getting-started/components

Where should I find this info?

2 Likes

For lifecycles, you can find the information here Components Lifecycles - The Aurelia Docs

I guess @HamedFathi been busy with updating the migration doc

3 Likes

@wayne My Aurelia docs was a test just for API part.

Ignore it. As @bigopon mentioned the official doc available under https://docs.aurelia.io/ URL.

About side-by-side comparison (v1 vs v2) you can follow Components - The Aurelia Docs too.

1 Like

I wanted to mention that I stumbled upon the same issue as @wayne. When I google ‘aurelia 1 to 2’:

And if I opened the first link then a Gitbook site opens up that has out of date info about the migration process and lifecycle events. It might be a good idea to get it up to date or remove it to avoid some confusion?

2 Likes