Read Data from .html to .ts file

//in home.ts file
@Input(“UserData”) UserData: User[ ];

I have UserData that that is read from a different page as above. The data is available and being used in the home.html page BUT, when I console I get undefined.

Since it’s available at html level, how can I read it in the home.ts file?
console.log(UserData);

This shoudn’t really work, I guess.

But can you show the HTML and TS file so we can see what is happening?

@MattE,
sorry it took me quite long to reply to you. I got the solution that involves event listeners. the home.htm/ts recieves data from another page, initpage.ts

//initpage.ts
async getUsers() {
    await this.user.getAppUsers().subscribe(
      users => {
        this.UsersData = users.data;
        this.events.publish("userData", this.UserData);
      },
      error => {
        throw error;
      }
    );
  }
//initpage.html
  <user-list  [UserData]="UserData">
  </user-list>

Then in home.ts I subscribe to the data as;

ngOnInit(): void {
    this.events.subscribe("userData", data => {
      this.uData = data;
     console.log(uData);
    });
}

Although I still not get why I am not able to get data for user UserData
//declared at home.ts
@Input(“UserData”) UserData: User[ ];
lf i log UserData it will result to undefined, but available for use in home.html

Hello,
@Input is resolved at a time when your async function has not yet returned a value.

Best regards, anna-liebt