Friday, January 19, 2018

In the previous article we had discussed about ng-repeat functionality so please walk through the below link about ng-repeat directive.

  • ng-repeat
  • Now we are going to present here how to fetch form data using Angularjs and display in codeigniter view as follows.
    Let’s create a database table name as registration as below.

    Angularjs for beginners – Learn angularjs step by step in a day

    Now lets us create codeigniter form for the above database table, now add ng-model directive attribute to all input fields in the form , and also add display form using ng-repeat directive in same codeigniter form as shown below.

    AngularJS: Up and Running

    For above html form let’s create angular module and controller to insert and fetch the data from mysql database.

    Using angular module create controller as ‘regController’ and post form data using http service , posted form data will passes as json data to codeigniter controller function , there we need to decode the json data and insert into mysql database table registration.
    After insertion, let’s fetch data using codeigniter get method and store it in an array $arr_data .

    Professional AngularJS (WROX)

    Let’s use codeigniter foreach iteration to store individual data into array and finally pass $arr_data into json_encode(); now check the code below.

    Here in the above controller function json encoded data is echoed, the converted data is returned to angular success function. Then by using ng-repeat directive we can display the data to codeigniter view.

    Thanks for reading this article, for any queries please use comments section.

    Tags: , , , , ,
I am Saritha Reddy, a Remote codeigniter,Angularjs Developer. I have 4+ years of strong experience in designing, implementing, Programming and delivering advanced XAMPP ( Apache, MySQL and PHP) Web applications development. I am an Indian national and based Andhra Pradesh,Hyderabad. In addition to providing custom programming and design, I also have extensive experience with Open Source technologies to keep costs down and get websites running with as little fuss and wait as possible.

3 Comments

Delia Maclanachan January 23, 2017 at 9:00 pm

Hi to every body, it’s my first go to see of this blog; this web site includes amazing and actually fine data for visitors.

    admin January 24, 2017 at 8:41 am

    Thanks Delia

Yogesh singh January 6, 2018 at 7:45 pm

Hi Saritha,
Thanks for the tutorial.
Can you have any tutorial available to check username availability using angular in CodeIgniter?

Thanks.

Leave a Comment