Thursday, February 22, 2018

As you all know Angularjs is getting popularity day by day, because of its data binding and dependency injection to reduce code, otherwise we need to write lot of code, client side framework, easy to integrate with any language which makes in top position. In previous discussion we had worked on ng-route model.
Now we will discuss how to update form using Angularjs and codeigniter, before going to concept you all need to know about Factory provider, which will adds below abilities.

  • We can use other services(which have dependencies).
  • We can initialize the service.
  • Delayed and Lazy initialization can be done using Factor recipe.

Now I will use factory recipe in our update form functionality, let’s create app.js file

Don’t be panic seeing the above angular code, which is easy to understand, let’s check the code now.
Here we create update controller in our app.js file, I had used dependency injection concept by calling factory service in update Controller.
In the factory recipe I used two functions to get the data which need to be updated and used post method to update the record, now I called these two functions in update controller.
Now let’s create form_edit.html in angular_pages folder as we discussed in previous article.

Now look at codeigniter controller functions below.

Now let’s check model function how to update a record using below code.



Now we are at last step, while clicking the edit link we need to pass user_id to the angular controller, I am adding the single line of code, which needs to be placed in users_list.html and also update route config as below.

This file is already created in previous article, Please go through the complete article.

Thanks for reading this article ,for any queries please use comment section. Subscribe to eknowledgetree for new and latest classes.

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.


Leave a Comment

So glad to see you sticking around!

Want to be the first one to receive the new stuff?

Enter your email address below and we'll send you the goodies straight to your inbox.

Thank You For Subscribing

This means the world to us!

Spamming is not included! Pinky promise.