我尝试打开API服务调用新窗口选项卡,但尝试使用 window.open() ,它不起作用 . 我也试着把 ng-href="URLwithParam" in the HTMLtemplate with target="_blank" . 我是角度和HTML的新手 . 请帮我
define(['directives/directives'],
function (directives) {
directives.directive('directiveFeeReport', ['reportServices', function (reportServices) {
var prmCompanyId;
var prmDateTranFrom;
var formattedPrmDateTranFrom;
var prmDateTranTo;
var formattedPrmDateTranTo;
var urlLink = "http://localhost:8080/sdimngapi/np_feereport/feeReportGenerate/";
var teststring;
function feeReportController( $stateParams, notification) {
this.roleId = $stateParams.id;
// notification is the service used to display notifications on the top of the screen
this.notification = notification;
};
feeReportController.$inject = ['$stateParams', 'notification'];
function init(scope, element, $stateParams, $window, $http) {
scope.generateFeeReport = function() {
prmCompanyId = scope.companyId;
prmDateTranFrom = new Date(scope.dateTranFrom);
formattedPrmDateTranFrom = prmDateTranFrom.getFullYear() + '-' + (prmDateTranFrom.getMonth() + 1 ) + '-' + prmDateTranFrom.getDate();
prmDateTranTo = scope.dateTranTo;
formattedPrmDateTranTo = prmDateTranTo.getFullYear() + '-' + (prmDateTranTo.getMonth() + 1 ) + '-' + prmDateTranTo.getDate();
// I TRY TO OPEN THE Service API calls to new window here.
//window.open('/theURL', '_blank');
// API Calls
reportServices.GetFeeReport(prmCompanyId, formattedPrmDateTranFrom, formattedPrmDateTranTo, function (res) {
//console.log(res);
})
});
};
//#region HTML Template
var feeReportTemplate = '
'
'' +
'
Generate Fee Report
' +'
'
' +'
return {
restrict: 'E',
link: init,
controller: feeReportController,
controllerAs: 'controller',
template: feeReportTemplate
};
} ]);
});