私は、ページの起動時に新しいページを開くしようとしているが、私はごく最近活字体とAngular4で作業を開始しましたので、私はそうじゃない角度4 NgOnInitReferenceエラー
Reference Error: Window not defined.
を得続けますこの2つの問題のどちらが本当に下にあるのか確かめてください。
export class HomeComponent implements OnInit {
testCall: Window;
constructor() {
this.testCall = new Window();
this.testCall.open(
"https://static.pexels.com/photos/104827/cat-pet-animal-domestic-104827.jpeg");
}
ngOnInit(): void {
console.log("function read");
window.open("https://static.pexels.com/photos/104827/cat-pet-animal-domestic-104827.jpeg");
}
私はOnInit()
内this.testCall.open
を使用する場合でも、私はだけでなくopen
方法で、参照エラーを取得します。
最初のページが開いてもすでに1週間前に開いていて、typescript/angular4セットアップでこれをどうやって行うのか分かりません。
既に試してみましたが、うまくいきませんでした。ウィンドウが定義されていません。 : – RoboKy
あなたはその行を削除する必要があります。メッセージが残っていれば削除しませんでした – trichetriche
もちろん、私はその行を削除しました。 – RoboKy