codeigniter angular js fetch data

I have “Posts” controller and “loaddata” function which :

public function loaddata(){
    $q = $this->db->get('posts')->result();
    $m =  json_encode($q);
    $this->load->view('ang', $m);
}

and my “ang” file in view:

<div ng-app="myApp" ng-controller="myctl">
<ul ng-repeat = 'x in users'>
<li>{{ x.name }}</li>
</ul>
</div>

<script>
var app = angular.module('myapp', []);
app.controller('myctl', function ($scope, $http) {
    $http.get(<?= site_url('posts/loaddata') ?>).then(function (mydata) {
        $scope.users = mydata.data;
    });
});

</script>

but what I get is:

{{x.name}}

please help and guide the solution.

Source: AngularJS