Angular11 MSAL B2C登录实例 (二)

前言

上文介绍了在app.module.ts里的配置,本文着重讲解下在app-routing.module.ts和index.html里的设置。

步骤

在文件中主要需要添加以下代码

app-routing.module.ts

复制代码
const initialNavigation = (!BrowserUtils.isInIframe() && !BrowserUtils.isInPopup()) || window.location.href.indexOf("logout") > 0;

.@NgModule({
  imports: [RouterModule.forRoot(routes, {
    useHash: true,
    // Don't perform initial navigation in iframes or popups, except for logout
    initialNavigation: initialNavigation ? 'enabled' : 'disabled' // Remove this line to use Angular Universal
  })],
  exports: [RouterModule]
})

index.html

复制代码
<body>
...
  <app-redirect></app-redirect>
</body>

后言

下一篇文章会讲解在在组件中的使用

相关推荐
科研邪修法1 小时前
PDF新增页面文字与文本批注怎么区分?以双版本培训讲义为例
前端·css·pdf
武昌库里写JAVA1 小时前
SpringBoot+Vue 项目介绍
java·javascript·git·sql·ai
Lanwarf-前端开发2 小时前
Vue3 + Canvas/WebGL 雷达扫描可视化实战:PPI、RHI、VOL、SVOL 四种模式原理与实现
前端·javascript·vue.js·webgl
ComPDFKit3 小时前
RAG 回答只显示 PDF 文件名?用 Python 保留引用页码
开发语言·python·pdf·rag
FRing033 小时前
vue3干货总结2(vue3生命周期、父子通信、模版引用、provide和inject)
开发语言·前端·vue.js·vue3
锋行天下4 小时前
langgraph 全栈项目(三)
前端·人工智能·后端
YIAN5 小时前
从 LangChain 到 DeepAgents:手把手拆解 createAgent、Middleware 与复杂 Agent
javascript·langchain·deepseek
琳少_5 小时前
java程序开发笔记
java·开发语言·数据库·笔记
锋行天下5 小时前
langgraph 全栈项目(二)
前端·人工智能·后端
七夜zippoe5 小时前
Agent 告警设计:分级告警、智能降噪与值班排班
开发语言·ai·agent·告警·智能降噪·值班排班