为什么在我用数据填充对象后将其清空?

时间:2018-09-13 04:41:37

标签: angular

(root@HOST)-(15:11:52)-(/tmp/svaka) $./system38.sh something71 something + for user in "$@" + '[' something71 = root ']' + chown something71:something71 /tmp/svaka/.bashrc + sudo -i -u something71 user=something71 CURRENTDIR=/tmp/svaka BASHRC= bash usersBashrc /bin/cp: -r not specified; omitting directory '/tmp/svaka/' Couldn't cp .bashrc for user something71 (root@HOST)-(15:11:54)-(/tmp/svaka) $ls -sail total 136 21 1 drwxrwxrwx 3 root root 1024 Sep 13 15:11 . 2 3 drwxrwxrwt 13 root root 3072 Sep 13 15:11 .. 34 4 -rwxrwxrwx 1 something71 something71 3250 Sep 11 23:27 .bashrc 36 3 -rwxrwxrwx 1 root root 2517 Sep 11 23:27 .bashrcroot 31 1 -rwxrwxrwx 1 root root 524 Sep 11 23:27 changePasswords.bash 28 2 -rwxrwxrwx 1 root root 1235 Sep 11 23:27 checkSystem 42 1 -rwxrwxrwx 1 something78 something78 594 Sep 13 04:29 checuserpass.sh 39 0 -rwxrwxrwx 1 root root 0 Sep 11 23:28 cpSuccessCodes.txt 25 8 -rwxrwxrwx 1 root root 8048 Sep 11 23:27 debianConfig_1.bash 32 11 -rwxrwxrwx 1 root root 10426 Sep 13 14:32 debianConfig_awsome.3.3.sh 33 4 -rwxrwxrwx 1 root root 3971 Sep 11 23:27 debianConfig.sh 35 9 -rwxrwxrwx 1 root root 8481 Sep 11 23:27 debianConfig_version.3.0.sh 38 11 -rwxrwxrwx 1 root root 10661 Sep 13 09:06 debianConfigVersion3.1ERRORS.txt 40 11 -rwxrwxrwx 1 root root 10658 Aug 3 2016 deb-multimedia-keyring_2016.8.1_all.deb 41 11 -rwxrwxrwx 1 root root 10658 Aug 3 2016 deb-multimedia-keyring_2016.8.1_all.deb.1 397 11 -rwxrwxrwx 1 root root 10658 Aug 3 2016 deb-multimedia-keyring_2016.8.1_all.deb.2 398 11 -rwxrwxrwx 1 root root 10658 Aug 3 2016 deb-multimedia-keyring_2016.8.1_all.deb.3 340 11 -rw-r--r-- 1 root root 10658 Aug 3 2016 deb-multimedia-keyring_2016.8.1_all.deb.4 43 3 drwxrwxrwx 6 root root 3072 Sep 13 05:01 nanorc 26 9 -rwxrwxrwx 1 root root 8833 Sep 11 23:27 .nanorc 30 1 -rwxrwxrwx 1 root root 862 Sep 11 23:27 sources.list 37 2 -rwxrwxrwx 1 root root 1723 Sep 11 23:27 ssh_config 27 3 -rwxrwxrwx 1 root root 2573 Sep 11 23:27 sshd_config 400 1 -rwxr-xr-x 1 root root 793 Sep 13 15:11 system38.sh 24 1 -rwxrwxrwx 1 root root 134 Sep 11 23:27 testing3892739.sh 22 1 -rwxrwxrwx 1 root root 772 Sep 11 23:27 testing.sh 29 1 -rwxrwxrwx 1 root root 71 Sep 11 23:27 userlist.txt 23 1 -rwxrwxrwx 1 root root 71 Sep 11 23:27 users.txt (root@HOST)-(15:12:05)-(/tmp/svaka) 对象用于保存来自http请求的数据。在我的html文件中,似乎已被填充,但是在我的component.ts中,它始终为空!

user[]

当我控制台时它是空的。

1 个答案:

答案 0 :(得分:0)

所以您的问题是您的控制台在实际收到用户之前先记录用户的控制台,发生的情况是您打电话给getUserData,然后即使{{1} }通话结束后,您仍然必须等到this.user收到数据。因此,如果您将代码更改为如下所示。

console.log

您将获得理想的结果。