AngularJS : How to use one resolve for all the routes of my application

前端 未结 6 986
陌清茗
陌清茗 2020-11-30 00:53

I would like to resolve the promise that loads the current user for all the pages of my application. Currently I repeat the resolve in every $routeProvider.when()

6条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 01:12

    The @Josh answer is correct, except you have to invoke originalWhen function differently:

    originalWhen.call($routeProvider, path, route);
    

提交回复
热议问题