fix angular error about using window