title: Trying to use angular js with codeigniter
body: <p>I am having an issue with using angular js with codeigniter. I am getting no error but the data is not showing up. I am trying to learn how to create a RESTful app with angularjs and Codeigniter if anyone has any example feel free to send me a link also. </p>
  
  <p>CI controller </p>
  
  <pre><code>&lt;?php
  class MasterController extends CI_Controller {
  
    function __construct() {
      parent::__construct();
    }
  
  
    function index() {
      $data['pagetitle'] = 'Page for Angular JS';
      $data['viewname'] = 'index';
      $this-&gt;load-&gt;view('master',$data);
    }
  
    function json_get_user() {
          $arr = array(
      array( "name" =&gt; "smith", "age" =&gt; "20", "city" =&gt; "adelade", "country" =&gt; "australia"),
           array("name" =&gt; "john", "age" =&gt; "20", "city" =&gt; "parth", "country" =&gt; "australia" ),
      array("name" =&gt; "david", "age" =&gt; "20", "city" =&gt; "london", "country" =&gt; "england")
      );
           echo json_encode($arr);
   }
  
  }
  ?&gt; 
  </code></pre>
  
  <p>CI view </p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.js"&gt;&lt;/script&gt;
  
  &lt;/head&gt;
  &lt;body ng-app="myApp"&gt;
  &lt;div class="span6" ng-controller="app_home"&gt;
     &lt;p&gt;My name is &lt;em&gt;{{name}}&lt;/em&gt;&lt;/p&gt;
     &lt;table class="table table-striped table-condensed table-bordered"&gt;
      &lt;tr&gt;
        &lt;th&gt;Name&lt;/th&gt;&lt;th&gt;Age&lt;/th&gt;&lt;th&gt;City&lt;/th&gt;&lt;th&gt;State&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr ng-repeat="user in users"&gt;
        &lt;td&gt;{{user.name}}&lt;/td&gt;&lt;td&gt;{{user.age}}&lt;/td&gt;&lt;td&gt;{{user.city}}&lt;/td&gt;&lt;td&gt;{{user.country}}&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/div&gt;
  
  &lt;script src="&lt;?=base_url()?&gt;app/homeapp.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>homeapp.js </p>
  
  <pre><code>var App = angular.module('myApp', []);
  function app_home($scope, $http) {
    $scope.name = 'John doe';
  
    // Initialising the variable.
    $scope.users = [];
  
    // Getting the list of users through ajax call.
    $http({
      url: base_url + '/masterController/json_get_user',
      method: "POST",
    }).success(function (data) {
      $scope.users = data;
    });
  }
  </code></pre>