I think you can do by something similar to below code:
//in your symfony controll
public function sampleAction() {
$data = $this->getDoctrine()->getManager()->getRepository('YourBundle:SampleEntity')->findAll()->toArray();
return $this->render('YourBundle:Views_Path:sampleTwigOutput.html.twig', array(
'data' = json_encode($data)
));
}
In your twig file you can have something like
<div ng-init="mydata = {{ data|raw }}"></div>
<table id="sortedData">
<tr><th>T1</th><th>T2</th></tr>
<tr ng-repeat="data in mydata | filter:sortData">
<td>{[{data.name}]}</td>
<td>{[{data.phone}]}</td>
</tr>
You also need to change the start and end symbol for to something different (like {[{
and }]}
) interpolateProvider
Now you need to define a sortData
js function like
angular.module('MySortModule', []).
filter('sortData', function() {
// do all your stuffs to sort the data base on whatever you want
// set them all to out
return out;
});
You can find more info about it on Angular filter
I would recommend to sort the data in DB through Symfony which is faster and in angular output just dump the data