angular - Angular(6)视图按钮(点击)功能重定向到Laravel(5.5)后端视图
问题描述
我希望当我单击 Angular 前端按钮重定向到 Laravel 后端视图时。我是 angular 的新手。这是我尝试做的。请帮助我。
前端.component.html
<button type="button" (click)="userDetailsEdit()">Edit Details</button>
前端.component.ts
userDetailsEdit() {
alert('Its Working');
this.authService.goToBreweryBarBackend();
}
auth.service.ts
goToBreweryBarBackend() {
const accessToken = JSON.parse(localStorage.getItem('access_token'));
headers.append('Content-Type', 'application/json');
this.http.get(this.url.LaravelURL + 'api/goToBreweryBarBackend', { headers: new Headers({ 'Authorization': 'Bearer ' + accessToken }) });
api.php
Route::get('/goToBreweryBarBackend', ['uses' => 'Homecontroller@index']);
家庭控制器.php
public function index()
{
return view('home');
}
解决方案
userDetailsEdit() {
window.location.href = 'http://localhost:8000/intro';
}
推荐阅读
- java - 我们如何通过 Jpa 获得完整的分层数据列表
- domain-driven-design - 如何打破相同的实体但不同的微服务域
- asp.net-mvc - 托管在 IIS 上的 ASP.NET MVC 应用程序在 50 个用户的压力测试中失败
- npm - libxmlsec1-dev 卸载 npm 和 npm 卸载 libxmlsec1-dev 为什么?
- vb.net - 尝试在 MD5 算法中处理消息块时算术溢出
- c# - 如何从 http 重定向到 https?
- python - 保持 python 日志记录脚本无限期运行的建议。脚本在几个小时后起作用
- asp.net-core - 带软删除的级联限制
- javascript - 更改检测不适用于文件上传
- clickhouse - Clickhouse:如何在 clickhouse 中使用“数据跳过索引”和“数据跳过索引操作”功能?