-1

I have a link and I'd like to open the link in the new tab. The problem is : I send object parameters.

HTML :

<a ng-click="go(row)" ></a>

JS :

$state.go('link', {
  'search': {
    'obj': {
      'id': something
    }
  }
});

I have already tried href and ng-href without success. Thank you.

Erazihel
  • 7,295
  • 6
  • 30
  • 53
Akim Benchiha
  • 150
  • 1
  • 12

1 Answers1

0

You can use something like this to open it in new tab using a controller function for go(row) like

$scope.go = function(row){
  var param = {
  'search': {
    'obj': {
      'id': something
    }
  };

  var url = $state.href('link', {parameter: param });
  //open in new tab
  window.open(url,'_blank');
}

and then access the parameter in your controller like this

$stateParams.parameter 

and value should be

{
 'search': {
   'obj': {
     'id': something
      }
}
Ankit Agarwal
  • 30,378
  • 5
  • 37
  • 62