I am new to Angular world.In my project,I want to open a component in a new tab using windows.open() from a contextmenu of ag-grid.These components are being used inside action - an inbuilt function in ag-grid context menu. Since it is inside Ag-grid,other html events cannot be used.
I have a TestScreen1Component which contains an ag-grid with context menu.On click of an item in the COnetxt Menu,I want to open TestScreen2Component in new tab.Currently I am using windows.open() for routing.This works fine in local build.However while doing a Production build by providing a base-href value this url is not working and giving me 404 error.
TestScreen1Component.ts
this.gridOptions.getContextMenuItems = params => {
console.log("getContentMenuItems()");
var result = [
{
name: "Always Disabled",
disabled: true,
tooltip: "Sample"
},
"separator",
{
name: "open Screen",
disabled: false,
action: () => {
window.open("/testScreen2", "_blank");}}];
return result;
};
routing-module.ts
const routes: Routes = [{
{ path: "/testScreen2", component: TestScreen2Component }];