mol*_*rat 6 javascript angularjs angular-ui-router
我想要做的是进入新标签或新窗口:
$state.go('studentsReport', {
type: $scope.report.type, // string
selectedStudents: $scope.selectedStudents // array of strings
});
Run Code Online (Sandbox Code Playgroud)
如果我做了:
var link = $state.href('studentsReport', {
type: $scope.report.type,
selectedStudents: $scope.selectedStudents
});
window.open(link, '_blank');`
Run Code Online (Sandbox Code Playgroud)
我会失去参数.
最好的问候,马塞尔
你应该尝试使用这个:
/* @ngInject */
function SomeCtrl ($state, $window) {
$window.open($state.href('stateName', {}, {absolute: true}), '_blank');
}
Run Code Online (Sandbox Code Playgroud)
注意:/* ngInject */如果使用ng-annotate(在cli,gulp和grunt flavors中可用),便于自动依赖注入注释