angular-routing

Angular 5 : Authentication guard automatically navigate to specified compnonent

蹲街弑〆低调 提交于 2019-12-25 03:15:18
问题 I have set an authentication guard with firebase email and password login, the issue is that it automatically trigger the route to the specified component I have implemented the authentication guard and set it in the correct module provider (because I have many providers in my application. This is my authentication service: import { Injectable } from '@angular/core'; import { Router, Route ,CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot, CanActivateChild, CanLoad } from '@angular

Angular6 Router navigate to multiple child routes that share the same component

孤街醉人 提交于 2019-12-25 01:49:58
问题 I have multiple child components that share the same component which works fine, however, I cannot route between the pages as it appears Angular suspects the component is already loaded. Is it possible to reload the component when attempting to route to these child routes? const ServicesRouting: ModuleWithProviders = RouterModule.forChild([ { path: '', component: StructureComponent, canActivate: [AuthGuard], children: [ { path: 'services', canActivate: [AuthGuard], component:

Deactivation of angular router link

回眸只為那壹抹淺笑 提交于 2019-12-24 20:58:40
问题 I am making angular application, where i am using routing and auth guard.. stackblitz app component html <div class="container"> <div class="row"> <div class="col-xs-12 col-sm-10 col-md-8 col-sm-offset-1 col-md-offset-2"> <ul class="nav nav-tabs"> <li role="presentation" routerLinkActive="active" [routerLinkActiveOptions]="{exact:true}"><a routerLink="/">Home</a></li> <li role="presentation" routerLinkActive="active"><a routerLink="/servers">Servers</a></li> <div *ngIf="showUser"> <li role=

External file loading reference loading issue due to dynamic routing in angular?

↘锁芯ラ 提交于 2019-12-24 20:52:47
问题 I am Using Angular Universal project. In that i have configured fully dynamic routing like below. { path: ':locale', component: HomePageCategory }, { path: ':locale/:id', component: HomePageCategory }, Now i have added PWA so manifest reference was added in html file like below. <link rel="manifest" href="./manifest.webmanifest"> issue raised like below 1. Failed to load resource: the server responded with a status of 404 (Not Found) 2. Manifest: Line: 1, column: 1, Unexpected token. can you

Angular 5 Routing can go to link by click but not by link

喜夏-厌秋 提交于 2019-12-24 19:23:41
问题 I'm a beginner having problem with Angular 5 Routing. I'm following this tutorial http://devarea.com/angular-5-routing-practical-guide/ Also tried some other tutorials and the result is the same. I'm on Windows 7 64 bit. When I click the link, say, "books", it goes to the correct page showing "localhost:4200/books", but if I enter exactly that or refresh the page, it shows "Cannot GET /books". Is this a bug? I made sure to read the tutorials over and over again. UPDATE: I was using Firefox 52

How to wait for promise from UI Router Resolve in Angular 1.5 Component

被刻印的时光 ゝ 提交于 2019-12-24 16:43:22
问题 I'm using Angular 1.5 Component. I could not figure out how to get the data via Resolve. Could you please shed some light? Plunker: https://plnkr.co/edit/2wv4YWn8YQvow6FDcGV0 <!DOCTYPE html> <html ng-app="app"> <head> <meta charset="utf-8" /> <title>AngularJS Plunker</title> <link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" /> <script>document.write('<base href="' + document.location + '" />')

Navigation to secondary route URL for routerLink attribute

微笑、不失礼 提交于 2019-12-24 11:05:05
问题 Angular supports primary routes as string attributes. i.e. <button routerlink="/path1">Click Me!</button> However, when there are multiple outlets, adding a secondary route does not work: <button routerlink="/path1(foo:/path2)">Click Me!</button> <<-- does not work Is there a way to make this work? Note: I realize its possible to achieve this with: <a [routerLink]="['/path1', { outlets: { foo: '/path2' } }]">Click Me!</a> My question is more about whether this is possible using plain string

Navigate to last visited child route when entering parent route Angular 5

♀尐吖头ヾ 提交于 2019-12-24 08:50:07
问题 In my Angular 5 application I have my router configured as this: { path: 'system-variables', component: SystemVariablesComponent, children: [ { path: '', redirectTo: 'partners-variables', pathMatch: 'full' }, { path: 'partners-variables', component: PartnersVariablesComponent, children: [ { path: '', redirectTo: 'partners-branches', pathMatch: 'full' }, { path: 'partners-branches', component: PartnersBranchesComponent, children: [ { path: '', redirectTo: 'register-partners-branches',

How to define Angular Routing in ASP.NET MVC

帅比萌擦擦* 提交于 2019-12-24 08:25:29
问题 I'm a bit confused about using the routing of Angular within an Asp.Net MVC app. To understand my question I will shown the currently code of my app: Index.cshtml: <head> ... @Styles.Render("~/Content/css") @Scripts.Render("~/bundles/modernizr") @Scripts.Render("~/bundles/jquery") @Scripts.Render("~/bundles/bootstrap") </head> <body> <div class="navbar navbar-default navbar-fixed-top"> <div class="container"> <div class="navbar-collapse collapse glyphicons pull-right"> <ul class="nav navbar

Angular Url without slash with optional parameters

不羁岁月 提交于 2019-12-24 08:13:28
问题 Both ui-router optional param without trailing slash and How to define optional parameter using UI-Router without trailing slash as well? have insufficient arguments and invalid (at least for my scenario i.e. working links (href) for angular routes without trailing slashes) answers . Live Demo Link Here are the example html links <div> <a ui-sref="home">Home</a> | <a href="#/posting/">Post 1</a> | <a href="#/posting">Post 2</a> | <a href="#/posting/sami">Post 3</a> | <a ui-sref="post">Post 4<