1

I have a parent componet <app-parent> and in this parent compoent there are few buttons each button will open a new floating panel on top of current parent and in each floating panel there are same buttons which will open the floating panel again on the top of the current floating panel (Stacking of panels) I want each floating panel will have a separate URL, How i will do that?

1
  • 1
    Welcome to SO! Could you add periods to your question to let others understand your question easier? Commented Oct 5, 2019 at 21:13

1 Answer 1

1

At the start of the project angular asks you if you want to have a routing module. If you agree, it will be created in your app folder. However, if for some reason you did not, then you can still generate it via this cli command: ng generate module app-routing --flat --module=app

This will give you a file similar to this:

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ProductAddComponent } from './product-add/product-add.component';
import { ProductGetComponent } from './product-get/product-get.component';
import { ProductEditComponent } from './product-edit/product-edit.component';

// here you can configure routes
const routes: Routes = [
  {
    path: 'product/create',
    component: ProductAddComponent
  },
  {
    path: 'products',
    component: ProductGetComponent
  },
  {
    path: 'edit/:id',
    component: ProductEditComponent
  }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

Just don't forget to reference it in your app module

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }
Sign up to request clarification or add additional context in comments.

1 Comment

After that we need only to add in more URL component on the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.