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.
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.
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.
Comments
Post a Comment