在我的Angular項目中,我從ngOnInit()調用方法ConnectToHueBridge()和listAllGoups()。在我看來,這兩種方法將並行執行。但我需要先運行ConnectToHueBridge(),然後運行listAllGoups()。我怎樣才能做到這一點? var MyHue = new huepi();
@Component({
selector: 'my-app
在我的應用程序組件中,我想檢查用戶是否在加載後立即進行身份驗證,並且如果不立即將用戶重定向到公共頁面,而不是加載主頁面(配置文件)頁面。我使用的Auth0服務可以在這裏找到:link to GitHub file 問題是,我應該在constructor或ngOnInit運行此爲什麼? if (auth.isAuthenticated()) {
router.navigateByUrl(.