Kris Roofe Kris Roofe - 11 months ago 67
AngularJS Question

How to assign value to angular scope in my blade.php

I get value form laravel

View::make('----', $data)
. And I want to assign some value to the angular
$scope.var1 ...
, if it cannot assign to
. Can I assign it to a local javascript var, and use the var in angular app?

Answer Source

according Jared Eitnier's advice, finally I implement as this, server side, public function info()

    $data['var1'] = $var1;
    $data['var2'] = $var2;
    $data['var3'] = $var3;
    return Response::json($data);

client side, $http.get("url")

    $scope.var1 = response.var1;
    $scope.var1 = response.var1;
    $scope.var1 = response.var1;