search

Home  >  Q&A  >  body text

angular.js - ng写的单页面,每次返回上一页的时候,都要重新加载一次数据即(loading)等待过程,怎么解决这个问题?

1、每个页面的动态数据都是在控制器里面用$http.get()获取的,然后在html页面用ng-repeat循环出来!
2、跳转页面 返回上一页我都是用a标签写的
出现问题:每次返回上一页的时候都要重新加载一次数据,这样给用户体验太差了!

PHP中文网PHP中文网2742 days ago602

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-15 17:11:08

    What do you use for routing? ui-router? Don’t jump directly to the a tag on a single page. You have to reload the resources every time.

    Generally, single-page routing has corresponding jump methods.

    Ng1, ui-router

    1. router-link='/xxx/xxx'

    2. In controller, $state.go('/xxx/xxx');

    reply
    0
  • Cancelreply