mercredi 23 mars 2016

Laravel - laracasts/PHP-Vars-To-Js-Transformer

I'm trying to get this package to work: http://ift.tt/1dvwKFA

I did everything according to the description, but I get no output of the variables.

Laravel Version: laravel/framework (v5.2.24)

My config/app

Laracasts\Utilities\JavaScript\JavaScriptServiceProvider::class,
'JavaScript' => Laracasts\Utilities\JavaScript\JavaScriptFacade::class,

My config/javascript

'bind_js_vars_to_this_view' => 'footer',
'js_namespace' => 'qwerTEST'

in my controller

use JavaScript;
JavaScript::put(['fett' => 'testtesttest']);

in my main view

@include('layouts.footer');

my footer.blade.php

`<div>some text</div>`

and in my view

@extends('layouts.intern')

@section('content')
    <script>
        console.log('test');
        console.log(qwerTEST.fett);
    </script>
@endsection

the javascript of chrome gives out

test
Uncaught ReferenceError: qwerTEST is not defined

And there is nothing with qwerTEST javascript namespace in the sourcecode. But I get no error at all.

Am I missing something?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire