What I want to do is following in but in a new Tab or new Window:
$state.go(\'studentsReport\', {
type: $scope.report.type, // string
selectedStude
You should trying to use this:
/* @ngInject */
function SomeCtrl ($state, $window) {
$window.open($state.href('stateName', {}, {absolute: true}), '_blank');
}
Note: the /* ngInject */
facilitates automatic dependency injection annotation if using ng-annotate (available in cli, gulp, and grunt flavours)
use ng-click on link tag and call a function. in function put your parameters in LocalStorage. then in app.run use $rootScope.$on("$stateChangeStart") and check if localstorage have parameters get params and call $state with params.
//in page controller:
var openNewTab = function () {
localStorage.newTab = JSON.stringify({
state: "yourState",
params: {
param1: "someparam1",
param2:"someparam2"
}
});
window.open(document.location.origin);
}
//angular app run config:
angularApp.run(function($state){
if(localStorage.newTab){
var newTab = JSON.parse(localStorage.newTab);
localStorage.removeItem("newTab");
$state.go(newTab.state, newTab.params);
event.preventDefault();
}
})
<a ng-click="openNewTab()" >open new tab</a>