angular4-router

How to use PathLocationStrategy on localhost?

六月ゝ 毕业季﹏ 提交于 2021-02-11 13:21:14
问题 I'm working on an Angular 4 web app and I need to use PathLocationStrategy (not HashLocationStrategy ). The only problem with PathLocationStrategy is that when I refresh a page, I instantly get a blank page with 404 errors in the console... Which is normal with PathLocationStrategy . Once on a server, I can fix that by redirecting the routes to point on index.html. But how to fix this issue on localhost when I launch my app with ng serve ? It would be ideal since I'm working in "livereload",

routerLink inside <mat-tab> angular material

天大地大妈咪最大 提交于 2020-12-30 04:59:48
问题 <a routerLink = "/add"></a><mat-tab label="Add Identity"></mat-tab> or <mat-tab label="Add Identity"> <a routerLink = "/add"></a></mat-tab>. I am new to Angular, Trying to use routing with above Angular material component. But its not appending the url when i am clicking on Home tab. Any help on this. 回答1: you can actually combine them into one like this: <a mat-tab-link [routerLink]="/add">Add Identity</a> you'll also need to make sure you're using <nav mat-tab-nav-bar> , instead of <mat-tab

routerLink inside <mat-tab> angular material

别等时光非礼了梦想. 提交于 2020-12-30 04:59:19
问题 <a routerLink = "/add"></a><mat-tab label="Add Identity"></mat-tab> or <mat-tab label="Add Identity"> <a routerLink = "/add"></a></mat-tab>. I am new to Angular, Trying to use routing with above Angular material component. But its not appending the url when i am clicking on Home tab. Any help on this. 回答1: you can actually combine them into one like this: <a mat-tab-link [routerLink]="/add">Add Identity</a> you'll also need to make sure you're using <nav mat-tab-nav-bar> , instead of <mat-tab

Need clarification RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true })

大憨熊 提交于 2020-07-20 17:34:50
问题 Kindly explain useHash: true method in angular 2 route method. My Questions: what is the purpose we using it. why the value is "true" why not "false" ? if the value is false, what could be happen ? RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true }) 回答1: By default, angular uses HTML5 location-based routing, which may cause you problems in some environments. In the shake of simplicity, we usually prefer hash-based routing which regularly works in every environment. You can have a look at

Need clarification RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true })

一笑奈何 提交于 2020-07-20 17:34:42
问题 Kindly explain useHash: true method in angular 2 route method. My Questions: what is the purpose we using it. why the value is "true" why not "false" ? if the value is false, what could be happen ? RouterModule.forRoot([ ABOUT_ROUTE ], { useHash: true }) 回答1: By default, angular uses HTML5 location-based routing, which may cause you problems in some environments. In the shake of simplicity, we usually prefer hash-based routing which regularly works in every environment. You can have a look at

Route to Same component with multiple Params

余生长醉 提交于 2020-05-16 20:11:52
问题 HTML Code <button (click)='getEnv("env")'>environment</button> <button (click)='getSchema("env","schema")'>schema</button> <button (click)='getEvent("env","schema","event")'>event</button> ROUTE FILE export const ROUTES: Routes = [ { path: '', redirectTo: 'home',pathMatch:"full" }, //{ path: 'home', component: HomeComponent }, { path: 'example', component: ExampleComponent }, { path: '**', component: HomeComponent }, { path: 'home/:env', component: HomeComponent,pathMatch:'full' }, { path:

Multiple components per route in angular

半城伤御伤魂 提交于 2020-01-04 11:03:32
问题 What I want to do is, I want to load the home component and sidebar component at the same time. const appRoutes: Routes = [ { path: '', component: HomeComponent, children: [{ path: 'sidebar', component: SidebarComponent, children: [ { path: 'about', component: AboutComponent }, { path: 'clients', component: ClientsComponent }, { path: 'services', component: ServicesComponent }, { path: 'contact', component: ContactComponent }, { path: 'datatable', component: DataComponent } ] }] } 回答1: You

Multiple components per route in angular

半世苍凉 提交于 2020-01-04 11:01:45
问题 What I want to do is, I want to load the home component and sidebar component at the same time. const appRoutes: Routes = [ { path: '', component: HomeComponent, children: [{ path: 'sidebar', component: SidebarComponent, children: [ { path: 'about', component: AboutComponent }, { path: 'clients', component: ClientsComponent }, { path: 'services', component: ServicesComponent }, { path: 'contact', component: ContactComponent }, { path: 'datatable', component: DataComponent } ] }] } 回答1: You

hide Navbar before login page in angular5

蓝咒 提交于 2019-12-24 23:48:13
问题 i'm working in angular5 app , so i've used an angular5 template in github , and i tried to do the same as this tutorial to hide the navigation bar before authentication https://loiane.com/2017/08/angular-hide-navbar-login-page/ I don't get any errors but the nav bar is always hidden even after the authentication of Users .. , i'm working with backend spring boot (spring security + JWT ) this is how the project structure looks like : The file app-sidebar-component.html : in this file i get a