angularjs - twig's dump ouput loaded via $http cannot be collapsed or expanded -


i have simple action(in symfony 2.8 using twig 1.23.1), renders string:

/**  * @route("/test", name="my_test_route")  *  * @return \symfony\component\httpfoundation\response  */ public function testaction() {       $returncontent = array(         'message'=>'my message',         'test' => array(             'one' => 'one',             'two' => 'two',             'three' => 'three',             'four' => 'four',             'five' => 'five',             'six' => 'six',         )     );      return $this->render('mybundle:message.html.twig', $returncontent); } 

the template outputs message , dumps test array:

{% extends 'mybundle::layout.html.twig' %}  {% block body %}     {{ dump(test) }}     {{ message }} {% endblock %} 

the above scenario working , expected dump output.

dump - version

however when output action using angular's $http service, i.e.:

webservices.getdata(ajaxurl).then(function (response) {     $scope[myvar] = $sce.trustashtml(response);  }); 

where service follows:

app.factory('webservices',['$http', function($http){      return {         getdata : function(ajaxurl){              return  $http.get(ajaxurl).then(function(response) {                  return response.data;             });         }     } }]); 

i, still expected output, dump output can no longer collapsed or expanded , expanded.

dump - broken version

obviously lots of data causes inconvenience least. , question $http service(or way using it) removes caret output of dump function? there way fix this?

thanks in advance.

in html context output not escaped correctly. try addslashes() in controller if intend dump html in twig templates must use <pre> tag.

source: http://twig.sensiolabs.org/doc/functions/dump.html


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -