angular-routing

Angular 6 - Children paths of lazy loaded module are not loading

扶醉桌前 提交于 2019-12-11 17:45:04
问题 I am trying to work with routing in lazy loaded modules, but it is not working. This is my app module routing. export const routes: Routes = [ { path: '', component: DefaultLayoutComponent, data: { title: 'Home' }, children: [ { path: 'holiday', loadChildren: './holiday/holiday.module#HolidayModule' } ] }, { path:"**", component:P404Component } ]; This is RoutingModule for lazy-loaded module. const routes: Routes = [ { path: '', children: [ { path: '', component: HolidayBookingComponent }, {

Using redirectTo in a nested <router-outlet>

本秂侑毒 提交于 2019-12-11 16:05:00
问题 I have this very simple router config: export const routes: Routes = [ { path: '', component: MiddleComponent, pathMatch: 'full', children: [ { path: '', redirectTo: './task-queue', pathMatch: 'full', }, { path: 'task-queue', component: TestComponent, }, ] }, ]; Demo: https://stackblitz.com/edit/angular-a7sxdf?file=app%2Fapp.routing.ts Where MiddleComponent 's template is just <router-outlet></router-outlet> . I'd expect that after page load I should be redirected to task-queue but I'm not. I

Angular base href not showing up in URL

假如想象 提交于 2019-12-11 15:54:46
问题 I am trying to deploy my angular application to a production environment that has an additional location step in url e.g. www.production-server.com/name-of-my-app appended to it. My application works just fine when I run it through angular cli on localhost:4200 and redirects through pages like it is supposed to for example from localhost:4200/page1 to localhost:4200/page2. But when I try to set the base href "architect": { "build": { "builder": "@angular-devkit/build-angular:browser",

Angular 4 route selection for category/subcategory or category/item for ecommerce web site

空扰寡人 提交于 2019-12-11 15:37:35
问题 My routes are: { path: ':categoryname', component: ProductsComponent}, { path: ':categoryname/:subcategoryname', component: ProductsComponent}, { path: ':categoryname/:itemname', component: ItemComponent}, { path: ':categoryname/:subcategoryname/:itemname', component: ItemComponent}, So my 2nd and 3rd route are similar. I do not want to change the url logic to something like: { path: 'category/:categoryname/:subcategoryname', component: ProductsComponent}, { path: 'item/:categoryname/

ngOninit of child component executing before completing service in parent component

房东的猫 提交于 2019-12-11 15:18:51
问题 I have two component panelComponent(parent) and dashboardComponent(child). The panelComponent has a subscription to a service in its ngOninit and its return value is used inside childcomponent ngOninit. The Problem is, on initial running my childs ngOninit executing before Parents service returns a value and I am getting a null result in child component. How to solve this issue? panelComponent.ts:- ngOnInit() { this.panelService.getUserProfile().subscribe( res => { this.panelService

How to connect the form in angular routing

社会主义新天地 提交于 2019-12-11 15:15:43
问题 i have added angular routing to my crud operation.. before without routing the data i added was able to display in the table but now after implementation of routing the data is not getting stored in the table here is the code of createemployee.component.html <h2>Add Employee:</h2> <form class="form-horizontal" #empForm="ngForm"> <div class="form-group"> <label class="control-label col-sm-2" for="name">Name:</label> <div class="col-sm-10"> <input type="text" class="form-control" name="name"

Show component in nested router

蹲街弑〆低调 提交于 2019-12-11 10:54:49
问题 I want to route to "config" router, which is nested 2 outlets deep but I'm unable to figure out the correct way to do so. <router> <router name="main"> <router name="config"> </router> </router> </router> In my routing.ts, I created 2 ways to reach the component: export const routes: Routes = [ { // Entrypoint. path: 'Foo', component: FooComponent, canActivate: [IsServerOnlineGuard], children: [ path: 'Bar', component: BarComponent, outlet: 'main', children: [ { path: 'Smtp', component:

Angular 6 router - replace some of the parameters of the current route

坚强是说给别人听的谎言 提交于 2019-12-11 08:07:26
问题 In my Angular 6 solution, the urls have this structure: /{language}/{app_section}/{object_id}/{view}?queryparams... A language selector component is shared by all sections of the application, and is included in the template of one of the parent routes so that it appears in all the children routes. When a user selects a new language, the component should replace only the {language} segment of the current route, leaving everything else unchanged, and navigate to the new route. It seems it

Reload not working when passing multiple params in ui-router state

风格不统一 提交于 2019-12-11 06:02:46
问题 I am using ui-router with parent and child states. My states are defined as below : .state("home.ben", { url: "/beneficiary/:name", abstract:true, templateUrl: "app/ben/views/ben-form.html", controller: "BeneficiaryFormController", controllerAs: "bfCtrl", params : {id:'',name:''},... .state("home.ben.general", { url: "/", templateUrl: "app/ben/views/partials/general.html", controller: "BeneficiaryGeneralController", controllerAs: "bGenCtrl", params:{id:'',name:''}, ncyBreadcrumb: { label:

Routing between Angular & Laravel

烂漫一生 提交于 2019-12-11 05:49:33
问题 I am trying to make a simple App in Angular , integration with Laravel 5 and facing issues while routing the application views. Routes.php looks like as below: <?php Route::get('/', function () { return view('index'); }); in Routes.php, i am handling only first time when application loads. But after that i want to handle all routing by Angular. So, i did like this: app.js file var membershipModule = angular.module('membershipModule', ['ngMaterial','ngRoute']); membershipModule.config(function