Angular returns data-bound local variables

[setting.component.ts]

  TagList = [];

  public getTagList() {
    this.settingService.getTags()
      .subscribe((response) => {
        this.TagList = response.data;
        console.log(this.TagList);  //A
    });
    console.log(this.TagList);  //B
  }

setting.service.ts

public getTags(): Observable<any> {
     return this.http.get<any>(`${this.appConfig.apiUrl}/setting/setting/`, { withCredentials: true });
}

as shown in the figure, the data returned by background can be printed normally at A
but B is undefined, some friends say it is asynchronous, and B uses setTimeout as well as undefined. Thank you

for guidance.
Apr.29,2022

just figure out the asynchronous callback


well, it's asynchronous, but it's not clear why setTimeout (console.log (this.TagList)) still doesn't work. But don't worry about it, just go to html and use TagList.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8caf8-10f9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8caf8-10f9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?