在Angular JS中调用$ state.reload()之后如何执行代码?

时间:2017-10-10 23:03:41

标签: javascript angularjs

我认为import json import sys import requests url = "https://npiregistry.cms.hhs.gov/api/?number=&enumeration_type=&taxonomy_description=&first_name=&last_name=&organization_name=&address_purpose=&city=&state=&postal_code=10017&country_code=&limit=&skip=" htmlfile=requests.get(url) data = htmlfile.json() for i in data["results"]: print(i) 是异步运行的,如何在执行代码之后等待它完成?

像,

$state.reload()

$state.reload(); futureFunc(); 不适合我。

1 个答案:

答案 0 :(得分:0)

您将在$ state.go

中获得回调

所以,做这样的事情

$state.go('wherever', {whenever: 'whatever'}).then(function() {
  // Get in a spaceship and fly to Jupiter, or whatever your callback does.
});