Click Me it works fine and the parameter passed if I remove the target att" /> Click Me it works fine and the parameter passed if I remove the target att" /> Click Me it works fine and the parameter passed if I remove the target att"/>

I use the following approach to display the page in a new tab, But when I am using target=“_blank” , my params were lost

80 views Asked by At
<a ui-sref="app.reports.equipmentarg({factoryId: fid})" target="_blank">Click Me</a>

it works fine and the parameter passed if I remove the target attribute but then it opens in the current tab which is not required. I want to open my page in a new tab with parameters successfully passing using the same approach

state('app.reports.shiftarg', {url: '/shift',
templateUrl: 'assets/app/modules/report/views/view/app.shift.report.html',
controller: 'ShiftReportCtrl',
params: { factoryId: null}
1

There are 1 answers

1
Mohammed Yousry On

As long as you used the url property, so you don't need the params property

so you have to add all the needed params to the url

state('app.reports.shiftarg', {
    url: '/shift/:factoryId',
    templateUrl: 'assets/app/modules/report/views/view/app.shift.report.html',
    controller: 'ShiftReportCtrl'
})

then in the html, you can use ui-sref

<a ui-sref="app.reports.equipmentarg({factoryId: fid})" target="_blank">Click Me</a> 

note that you missed the closing double quotation " before the target attribute