I am implementing an iFrame in my angular application. When i am giving the src url directly in the html, the app is working fine and loading the requested UI. But when i am fetching the src url from backend and passing it as a variable auth guard is redirecting the url to login page. How to fix this?
DefectsManagementComponent.html:
<div class="container-fluid dtep-style dtep-min-height-569px-minus-56px">
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="form-group"></div>
</div>
</div>
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<div class="form-group">
<iframe id="defects" class="col-lg-12 col-md-12 col-sm-12 col-xs-12" title="Defects Management" src="url">
</iframe>
</div>
</div>
</div>
</div>
DefectsManagementComponent.ts:
export class DefectsManagementComponent implements OnInit {
url: string;
constructor(private service: SolutionInstanceService) {
}
ngOnInit() {
this.service.fetchSolutionByName("DEFECT_MANAGEMENT").subscribe(data =>{
this.url = data["solutionURL"];
});
}
}
AppRoutingModule.ts:
const routes: Routes = [
{
path: "login",
component: LoginComponent
},
{
path: "home",
canActivate: [AuthGuardGuard],
component: HomeComponent
},
{
path: "defects",
component: DefectsManagementComponent
},
{
path: "",
redirectTo: "login",
pathMatch: "full"
},
{
path: "**",
redirectTo: "login",
pathMatch: "full"
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule]
})
export class AppRoutingModule