Aurelia 2 - Lifecycle methods not working? (SOLVED)

Hello!

This doesn’t work for me:

`

export class MyApp {

public message = 'Hello World!'

constructor() {

}


attached() {
  
    setTimeout(() => this.message = 'Changed', 4000)
}

}`

But the following DOES work:

`
export class MyApp {

public message = 'Hello World!'

constructor() {

    setTimeout(() => this.message = 'Changed', 4000)
}

}`

For some reason, the attached/bind/etc lifecycle methods are not working for me in basic Aurelia 2 demo.

That was a breaking change on the lifecycle method names. Try afterAttach.

2 Likes

HOly smokes! Didn’t even know that site existed, not linked from official guide.

Thank you : )

:slight_smile: I was confused about this as well.

The “official documentation” (https://aurelia.io/docs) contains the v1 documentation.

As you may already know, Aurelia 2 is still in an early development phase. I guess that’s why the documentation for the new v2 release (https://docs.aurelia.io) is indeed not (yet) accessible from Aurelia’s main site.

The Aurelia 2 documentation is also available in its GitHub repository (https://github.com/aurelia/aurelia). I assume that the new documentation site is regularly (or even automatically) built from the GitHub repo.

2 Likes