Search Posts

Category: codeigniter

How to update angular data without refreshing the page?

I have some data in a database table that I used angular to show it. And I use the following script which is in the footer to do that: <script !src=””> var app = angular.module(‘enterprise’, []); app.controller(‘entercontroller’, function($scope, $http){ console.log(‘success’); $http.post(‘http://localhost/clinic/Groups_/load_data’) .then(function(mydata){ console.log(mydata); $scope.datas = mydata.data; }); $scope.loadData=function(){ $http.post(‘http://localhost/clinic/Groups_/load_data’) .then(function(mydata){ $scope.datas.push(mydata.data); }); } }); And my load_data() function in my controller like: public function load_data(){ $data[“groups”] = $this->Groups->fetch_groups(); return $this->output ->set_status_header(200) ->set_content_type(‘application/json’, ‘utf-8’) ->set_output(json_encode($data[“groups”], JSON_PRETTY_PRINT […]

AngularJS – POST JSON Array To MySQL Database – PHP

Okay so I am working on a Codeigniter 3.0 application and attempting to post an array of JSON data to the database. But I am not getting an logs regarding the issue and cant seem to find out what I am doing wrong. Any help would be greatly appreciated. Right now here is the following Angular Array: $scope.packageDetails = [ {ID: 1898, Number: 909, Name: “test”, category: “cat”}, {ID: 1899, Number: 919, Name: “test 2”, […]

How to fetch a value from a database in a <p> tag and to post them into database with the same id

I am new to angularjs and I want to make an application just like a Google keeps notes. I succeed in fetching the data inside the <p> tag in the list format. My condition is whenever I make any changes in the <p> tag, it is in the database. I tried to do this with ngKeyup() but I did not succeed so I removed ngKeyup(). How can I do this with the ajax jquery or […]

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