AngularJS and Codeigniter : Retrieve data from the database

Here I would will like to show you how to use Angular JS in CodeIgniter and I will show you how to get data from the database in Codigniter using Angular JS.

view : angularjs_view.php

Controller: Angularjs.php

Model : User_model.php

That’s it.

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

18 Comments

  1. Easy to implement, I got a question though: What if I have several controllers – Angular controllers – and they are all at the app.js, how can I make the call to my codeigniter controllers? Thanks!

  2. Easy to implement, I got a question though: What if I have several controllers – Angular controllers – and they are all at the app.js, how can I make the call to my codeigniter controllers? Can I just use the $http.get() from the app.js? Thanks in advance.

  3. Hi Arjun, I am new to both codeigniter & angularjs and trying to find the best way to use both, I have read many article on the same, what I got is there are two ways one is to create an api in CI and use it in angularjs and second is the one you have mentioned. Please can you tell me which one is better and why?
    Also there is one spelling mistake, in controller angularjs.php in index function, to load the view you mentioned the filename “angularjs_view.php” whereas it should be “angular_view.php”.
    Hoping to hear from you.
    If it is comfortable with you mail me on [email protected]

    1. Hi Raghav thanks for the comments. Yes there is a typo I have updated it. I, personally, prefer creating an api because it is more elegant and it’s totally separates the backed piece.

  4. hi,
    Instead of json can we use mysql db from the model. How the action flow from form action. If i want to fire a action from front-end to controller how i can send action

  5. Hi Arjun
    I am one of the beginner.
    Can you please show demo of update record functionality in codeIgniter using Angularjs.

Leave a Reply

Your email address will not be published.