title: how to display data in input field using angular js
body: <p>First off all, I want to show the json data from my <code>codeigniter</code> <code>controller</code> in <code>view</code> page through <code>$http post</code> method.</p>
  
  <p>The problem is that I'm facing some problems, then I can't make it works.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>.state('GetData', {
   url: "/getdata",
   templateUrl: base_url + "loadl/getdata",
   data: {
     pageTitle: 'Datapage'
   },
   controller: "Mycontroller",
   resolve: {
     deps: ['$ocLazyLoad', function($ocLazyLoad) {
       return $ocLazyLoad.load({
         name: 'Myapp',
  
         files: [
  
           base_url + 'application/assets/js/controllers/Mycontroller.js'
         ]
       });
     }]
   }
  })
  </code></pre>
  
  <p><strong>Controller:</strong></p>
  
  <pre><code>angular.module('Myapp')
   .controller('Mycontroller', function($rootScope, $scope, $http, $timeout) {
  
     $http.get(base_url + "getData/show").
     success(function(response) {
       $scope.data1 = response.data;
     });
   });
  </code></pre>
  
  <p><strong>CI controller</strong></p>
  
  <pre><code>public function show() {
    echo '{"data":[{"sl_num":"1","name":"James","category":"1"}]}';
  }
  </code></pre>
  
  <p><strong>View:</strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
    &lt;label class="control-label"&gt;Name&lt;/label&gt;
    &lt;input type="text" placeholder="John" class="form-control" ng-model="data1.name" /&gt;
  &lt;/div&gt;
  </code></pre>