Angular uiRouter open state in new window or tab with stateParams

前端 未结 2 820
天命终不由人
天命终不由人 2021-02-09 07:56

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         


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-09 08:08

    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)

提交回复
热议问题