S
S
sanex33392016-02-13 12:47:09
JavaScript
sanex3339, 2016-02-13 12:47:09

Laravel 5 + Angular 2 bundle - how to set up routing correctly?

Playing around with Angular 2 + Laravel 5.
Angular2 has 2 routes, base '/' and Edit '/edit'.
Laravel5 has 2 routes exactly the same - basic '/' and '/edit'.
How to make redirects from Laravel routes to Angular ones?
For example now, I go to '/', perform some actions, angular2 redirects me to its '/edit' route.
I get to the page 'blablabla.com/edit'. It works out the Angular component.
If I refresh the 'blablabla.com/edit' page, Laravel's router will work at this address, which is logical. But how do I redirect Laravel's '/edit' route back to Angular's '/edit' route in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sanex3339, 2016-02-13
@sanex3339

Got an answer on SO.
stackoverflow.com/questions/35378614/angular2-lara...
Briefly: or do it via HashLocationStrategy, then all A2 paths will have # in front of them.
Or, for all A2 routes in L5, redirect to the entry point for A2. In this example, index.html will be brought to StackOverflow, but for me it is the blade template views/backend/content.blade.php, so I made a controller for such routes and indicated in the action:
Now everything is ok.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question