Laravel X AngularJS - prefix/trailing slash -
As you know, Laravel4 leaves the indexed slash with all URLs. I have Laravel4 X AngularJS SPA (single page application), and just my current URL looks like this:
http: // localhost / en # / nglink What I want to achieve is to make the link look like this:
http: // localhost / en / # / nglink As you can see, I need a trailing slash before the AngularJS link (# / englink) followed by a prefix slash, or Laravel's link (http: // localhost / en). What is there anyway to get it using the Angies? How to get it without editing the main files of Laravel?
Well, although it is possible to achieve AngularJS or Laravel or http server side, but it is better Is & amp; Without touching primarily and without touching the main code (primarily the URLGenerator) can override, and keeping the code (server agnostic), it can be simplified through the leverage, so it's Apache / NGNX or Can work behind slash with any other server (so I do not like to work with htaccess).
Update # 1 Laravel 5 / AppServiceProvider :: register ()
$ this-> App- & gt; Binshare ('url', function ($ app) {$ route = $ app ['router'] - & gt; getRoutes (); $ request = $ app- & gt; to reset ('request', function $ $ App, $ request) {$ app ['url'] - & gt; setRequest ($ request);}); // This is your custom override "UrlGenerator" class $ urlGenerator = new UrlGenerator ($ route, $ request) ; Return $ url generator;});
Comments
Post a Comment