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C;IACzE,OAAA,iBAAiB,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,UAAC,KAAK,IAAK,OAAA,CAAC,CAAC,KAAK,CAAC,UAAU,EAAlB,CAAkB,EAAE,EAAE,cAAc,CAAC;AAAhF,CAAgF,CAAC",
|
10 | "sourcesContent": [
|
11 | "import { isString, isFunction } from '../common/predicates';\nimport { Transition } from '../transition/transition';\nimport { services } from '../common/coreservices';\nimport { TargetState } from '../state/targetState';\nimport { TransitionService } from '../transition/transitionService';\nimport { TransitionHookFn } from '../transition/interface';\n\n/**\n * A [[TransitionHookFn]] that redirects to a different state or params\n *\n * Registered using `transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectHook);`\n *\n * See [[StateDeclaration.redirectTo]]\n */\nconst redirectToHook: TransitionHookFn = (trans: Transition) => {\n const redirect = trans.to().redirectTo;\n if (!redirect) return;\n\n const $state = trans.router.stateService;\n\n function handleResult(result: any) {\n if (!result) return;\n if (result instanceof TargetState) return result;\n if (isString(result)) return $state.target(<any>result, trans.params(), trans.options());\n if (result['state'] || result['params'])\n return $state.target(result['state'] || trans.to(), result['params'] || trans.params(), trans.options());\n }\n\n if (isFunction(redirect)) {\n return services.$q.when(redirect(trans)).then(handleResult);\n }\n return handleResult(redirect);\n};\n\nexport const registerRedirectToHook = (transitionService: TransitionService) =>\n transitionService.onStart({ to: (state) => !!state.redirectTo }, redirectToHook);\n"
|
12 | ]
|
13 | } |
\ | No newline at end of file |