Use angular timeout directive instead of setTimeout.