0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

AngularJS で $window.location.reload(); のタイミングが変わった??

Last updated at Posted at 2019-03-26

Chrome 73 でAngularJSで書いたコードの動作が変わってしまった

$location.path('/foo');
$window.location.reload();

みたいなコードがあって、 Chrome 72 まではちゃんと /foo を表示していたのが、 Chrome 73 になると表示中の画面の URL でリロードするようになってしまった。

調べてみるとパスの置き換えよりも前にリロードされている感じ。

Chrome 73 での変更点

:link: Chrome 73 :コンストラクタブル スタイルシート、新しい正規表現関数、Passive mouse イベント

関連性があるか?と言われると、… :thinking: :question:

とりあえず動作させる

$location.path('/foo');
$timeout(function() { $window.location.reload(); });

タイム・アウトさせると動く。

$window.location.href = '/foo';

リロードじゃないけど、これでもまあ動く。

同じ事象に悩んでる人いないかもしれないけど、まとめ

割とタイムリーなタイミングだったのでまとめました。
でも Chrome のバージョンアップで動作変わるとかやめてほしいよ… Go○gle 先輩 :innocent:

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?