我在网站上有一个按钮,如果单击该按钮,则应创建Pdf文件并在新的浏览器标签中将其返回。但是我只需要在方法将结束创建文件后返回它。而且它必须在controller中,因为我在逻辑中使用import {Component, ViewChild} from '@angular/core';
import {NavController, Platform} from '@ionic/angular';
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
import {StatusBar} from '@ionic-native/status-bar/ngx';
import {Router} from '@angular/router';
import {GettingStartedPage} from './getting-started/getting-started.page';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
})
export class AppComponent {
@ViewChild(NavController) nav: NavController;
rootPage;
constructor(
private platform: Platform,
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private NavCtrl: NavController) {
this.initializeApp();
}
// Eindigt constructor
initializeApp() {
this.platform.ready().then(() => {
this.splashScreen.hide();
// set status bar naar onze app kleur
this.statusBar.backgroundColorByHexString('#E84B56');
});
}
openPage(page) {
// Reset the content nav to have just this page
// we wouldn't want the back button to show in this scenario
this.rootPage.navigateRoot('/getting-started');
}
}
。
我试图制作一个异步控制器,但是一旦单击按钮,它就会开始重定向。
我在考虑ControllerContext
-但在这种情况下,它无法制作Ajax.Actionlink
。
仅创建文件方法后,如何才能使后台控制器调用和重定向?
Asp.Net MVC应用程序。
我的看法:
return.File()
控制器:
@Html.ActionLink("Выгрузка", "Unload", null, new { @class = "btn btn-primary btn-lg", @target = "_blank" })
// or this
@Ajax.ActionLink("Create Pdf", "Unload", new AjaxOptions { HttpMethod = "GET" })