Problems with angular heading 2 and Laravel 5

Asked

Viewed 111 times

0

I have a system in Laravel 5.3, and I’m putting in Angular 2 to take care of the front end. I have several modules, ex: companies. The route /companies will lead to the listing of companies thus staying: localhost:8000/enterprises ... But here’s the thing, in this view, I load the.Component app from angular2 to do a routing ( to do a single page of companies ), but when it loads the route from angular 2, it adds the link at angular only getting localhost:8000, and gives some errors, like:

EXCEPTION: Uncaught (in Promise): Error: Cannot match any Routes: 'businesses'

But even appearing this error, everything works, but the problem is that add the Url of the Laravel and is practically in the root of the angular... I thought of something like: I have to load the angle already with /companies ( as root ), but how to do?

  • You can post codes to illustrate the question?

1 answer

0

I’ve already done it, for anyone who has any doubts. I did two steps: -> at index.php I put

 <base href="/empresas"> 

for before I was only

<base href="/"> 

so he would return the address to localhost:8000. And referring to the error, we had to specify the root route, which in the case is empty "". Thank you for your attention

Browser other questions tagged

You are not signed in. Login or sign up in order to post.