Angular js with codeigniter

I want to show data in a table with angular js. I have tried many code but didn't solve my problem. Please help

Here is my code of View page..

Script code

    var app = angular.module('myApp', []);
    app.controller("customersCtrl", function($scope, $http) {   
    $http.get('<?php echo base_url('items/getRecords'); ?>').
success(function(data, status, headers, config) {       
    $scope.users = data;


  <div ng-app="myApp" ng-controller="customersCtrl">                
            <table class="datatable table table-striped table-bordered" id="example">
                        <th>Product Code</th>                       
                        <th>Product Name</th>                           

                    <tr class="gradeA" ng-repeat="x in users">

                        <td style="text-align:center;">{{x.item_code}}</td>                         
                        <td style="text-align:center;">{{x.item_name}}</td>         




On Controller

 public function getRecords(){

    $this->output->set_header('Content-type: application/json');

And finally on Model

public function getTransactionData(){

    return $query->result();


Here is Json format of my result:

  [{"itrans_id":"17","cocode":"OFLT","yearcode":"OFLT16","vseries":"S","vnum":"1","vdate":"2015-10-06","linenum":"1","item_type":"services","item_code":"26","item_name":"AC Repair"}];

Console log


please read tutorial from here, there is good way to do integrate angularjs with codeigniter php framework.

Apparently, code is correct.

you need to debug to check whether you are getting right JSON format. check this using console.log($scope.user)..instead of data.length.

use devtool to see what it returns. Put that snapshot here.

and don't you need to initialize the user !

 $scope.user = [];

Need Your Help

Codeigniter Profiler not showing INSERT and UPDATE queries

php codeigniter

I am working on codeigniter 3.0 and need to print all queries in page.

IOS Jailbreak How do intercept SMS / Text Messages

ios sms hook jailbreak intercept

I'm currently trying to write an application that intercepts text messages and reacts depending on the content of that message.