Angular (6) 查看按钮(点击)函数重定向到 Laravel(5.5) 后端视图
Angular (6) view button (click) function redirect to Laravel(5.5) Back-end View
我想当我点击 angular 前端按钮时重定向到 Laravel 后端 View.I 是 angular.This 的新手,我尝试 do.Please 帮助我。
frontend.component.html
<button type="button" (click)="userDetailsEdit()">Edit Details</button>
frontend.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']);
HomeController.php
public function index()
{
return view('home');
}
userDetailsEdit() {
window.location.href = 'http://localhost:8000/intro';
}
我想当我点击 angular 前端按钮时重定向到 Laravel 后端 View.I 是 angular.This 的新手,我尝试 do.Please 帮助我。
frontend.component.html
<button type="button" (click)="userDetailsEdit()">Edit Details</button>
frontend.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']);
HomeController.php
public function index()
{
return view('home');
}
userDetailsEdit() {
window.location.href = 'http://localhost:8000/intro';
}