angular的@uirouter的lazyload功能,在使用onBefore hook时,如果不进行一定设置是监听不到lazyload的hook的。原来是因为lazy loade hook的优先级是0,要设置此hook需要在onBefore中设置priority: 1


You should be able to implement this with these existing primitives:
* lazyLoad property on a state
* An onBefore Transition Hook when entering a lazyload state
* A Transition promise
const criteria = { entering: (state) => !!state.lazyLoad };
const options = { priority: 1 };
const hook = trans => {
console.log('Lazy load starting...');
const done = () => console.log('Lazy load complete!');
trans.promise.then(done, done)
uiRouter.transitionService.onBefore(criteria, hook, options);

Here’s an example:

Note: priority: 1 is necessary because the lazy load hook itself is a priority 0 onBefore hook.

分类: angularjs

7 条评论

lipitor medication · 2021年3月17日 上午5:55

citalopram price citalopram 10mg pricescitalopram prices citalopram without prescription

levaquin 250mg without a prescription · 2021年3月25日 上午4:17

prochlorperazine generic prochlorperazine 5 mg priceprochlorperazine tablets prochlorperazine prices

keflex 500 mg pills · 2021年4月17日 上午12:04

where to buy acetazolamide cheap acetazolamide 250 mgacetazolamide purchase acetazolamide coupon

cost of lopid · 2021年5月8日 上午3:29

oxybutynin without a doctor prescription where to buy oxybutynin 5mgoxybutynin purchase oxybutynin pills

Galempolype · 2021年5月28日 下午6:13

Mojoheadz Records remains at the forefront of mind-expanding soundz. Even today, the imprint embraces the obscure and abstract just as passionately as it did in its formative years, never losing sight of its creative vision as it’s grown and flourished year upon year.Check review…

meclizine 25 mg without a prescription · 2021年7月3日 上午5:53

hydrochlorothiazide price how to buy hydrochlorothiazide 5mghydrochlorothiazide uk hydrochlorothiazide prices

remeron tablet · 2021年9月13日 上午6:09

order azathioprine how to purchase azathioprine 50mgazathioprine purchase where can i buy azathioprine


邮箱地址不会被公开。 必填项已用*标注