How can I pass a Laravel variable into my AngularJS view?

后端 未结 2 1476
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-19 00:06

I am building a small photo application to learn AngularJS 1.3. I come from a PHP background so conceptually this is rather different for me :)

I\'d like to pass a v

2条回答
  •  盖世英雄少女心
    2021-01-19 00:49

    Did you managed to have Angular and Blade syntax in order? In my case I changed what Laravel uses for echoing variables and evaluating expressions this way setting at routes.php:

    Blade::setContentTags('[[', ']]');        // for variables and all things Blade
    Blade::setEscapedContentTags(',.', '.,');   // for escaped data
    

    I'm not sure about how a good practice is but time to time I set some ng-init directives this way:

    Blade template

    ...

    View

    The way I obtain a rendered view this way:

    ...

    Then you could reach it from a controller and use it for ng-Route this way:

    $scope.constants.upload_url
    

提交回复
热议问题