如何在 Angular 4 上获取引用 URL?例如,说example.com 是我的角度网站,如果从另一个php 页面访问example.com,则说domaintwo.com/checkout.php。如何从我的角度网站中识别引用的 url(domaintwo.com/checkout.php) ..?我正在寻找像$_SERVER['HTTP_REFERER']PHP这样的解决方案(angular4 需要相同的过程)。提前致谢
javascript typescript angularjs-directive angular-ui-router angular
"styles": [
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/datatables.net-dt/css/jquery.dataTables.css",
"../node_modules/datatables.net-buttons-dt/css/buttons.dataTables.css",
"styles.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/popper.js/dist/umd/popper.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/jquery/dist/jquery.js",
"../node_modules/datatables.net/js/jquery.dataTables.js",
"../node_modules/datatables.net-buttons/js/dataTables.buttons.js",
"../node_modules/datatables.net-buttons/js/buttons.colVis.js",
"../node_modules/datatables.net-buttons/js/buttons.flash.js",
"../node_modules/datatables.net-buttons/js/buttons.html5.js",
"../node_modules/datatables.net-buttons/js/buttons.print.js",
],
Run Code Online (Sandbox Code Playgroud)
这是我为我的项目创建的 angular-cli.json 文件。
项目的组件如下所示;
ngOnInit() {
this.dtOptions = {
pagingType: 'full_numbers',
pageLength: 10,
dom: 'Bfrtip',
buttons: [
'copy', 'print', 'csv','columnsToggle','colvis','pdf','excel']
};
this.loadapi();
}
Run Code Online (Sandbox Code Playgroud)
在这里,我从示例 json 创建了一个数据表。除了导出excel和pdf的按钮没有显示其他按钮显示在UI上之外,一切都很好。可能是什么问题?