lundi 4 janvier 2016

Migrating Laravel routing to Angular JS routing or workaround

I have a demo site running on Laravel as Back-end and Jquery on front and was attempting to migrate Jquery to Angular JS. I was trying to achieve this using Laravel as routing and as a service for AngularJS. But this way I can't get variables on through URI on Angular (at least i couldn't find any way). Example:

http://localhost/estudio_php/user/perfil/1/edit

Angular Controller:

app.controller('estudioPerfilCtrl', function($scope, uiGmapGoogleMapApi, estudioService) {
$scope.loading = true;

//Issue here, getEdit(1) to get data from id = 1, need to get URI variable value
estudioService.getEdit(1).then(function(response) {...}

Laravel Routing

Route::group(array('prefix' => 'estudio'), function(){

//auth
Route::group(array('middleware' => 'auth'), function(){
    Route::group(array('prefix' => 'ajax'), function(){
        Route::get ('{id}/edit',                    'Estudio\PerfilController@editAjax');
    });

    Route::get ('{id}/edit',                'Estudio\PerfilController@edit');

The /ajax/edit route feeds data to Angular Service, and the /edit loads Laravel view, that calls Angular Controller.

Should I migrate all routing to AngularJS? Or is there a work around for my problem?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1O6PU79
via IFTTT

Aucun commentaire:

Enregistrer un commentaire