Search Posts

Category: codeigniter

CodeIgniter 3 Implement Promise

My CI app makes API call to third party Rest API server which will be consumed by front end. At first, front end app will hit my CI app and which in turn will hit third party LogInAPI(session valid for 15 mins), and after login we need to hit subsequent API calls by passing the key(response of loginApi) in header. So basically I need to hit loginAPI for every 15 minutes. I am trying angular […]

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. […]