json - AngularJs + Best practice to view / update the data - after updation again reload the data in model -


In my angular applications, I am a little confused about the standard way of implementation. Please take a look at my code structure and give some suggestions to make it more effective.

  var app = angular Module ("userup", []); App.controller ('UsersListCtrl', function ($ scope, $ http) {$ http.get ('/ ShowAllUsersList.json') Success (function (data) {$ scope.users = data ;.});}); $ Http.get ('/ logged inUserInfo.json'). Success (function (data, position, header, config) {$ scope.logged_in_user = data;}). Error (function (data, status, header, config) {// log error}); } App.controller ("logged inUserInfoCtrl", ['$ scope', '$ http', function ($ scope, $ http) {$ scope.updatePersonalInfo = function () {$ scope.user_personal_info = {username: $ scope. Logged_in_user .username, primary_email: $ scope.logged_in_user.primary_email, first_name: $ ('# first_name') val (), last_name: $ ('# last_name') value (), SECONDARY_EMAIL: $ ('# SECONDARY_EMAIL') .Val (),} $ http.put ('/ UpdatePersonalInfo', $ scope.user_personal_info) success (function, data, status, header, config) {warning ('data updated successfully.');}). Error (Function (data, position, header, config) {warning ('error');})}}}}]);   

Now I can not find a way to completely reload the data in the realm with reloading the page. I tried putting the load job, but it did not work. Please give some suggestions.

Thank you in advance

You need to make a service

Please read the documentation:

Also a video:

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -