Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8918833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:51:01+00:00 2026-06-15T05:51:01+00:00

Here’s how I defined my $resource: app.factory(‘User’, function($resource){ return $resource(‘/api/user’, {}, { get: {

  • 0

Here’s how I defined my $resource:

app.factory('User', function($resource){
    return $resource('/api/user', {}, {
        get: { method:'GET'},
        update: { method:'PUT'},
    })
})

And here’s my controller:

function SettingsCtrl($scope, $http, User) {
    $scope.user = User.get(
        {}, //Params

        function(data) { //Successfully received data

        },
        function(data) { //Failure to receive data

        }
    );

    $scope.saveUser = function() {
        $scope.user.$update();
        console.log($scope.user);
    };
}

The User.get() call at the top of the controller is correctly getting the data from the backend. In my HTML I’ve made a button that calls the $scope.saveUser function and created some inputs with ng-model, and it would appear that two-way data binding is working correctly. When I call console.log($scope.user) in the $scope.saveUser function, it returns the user object exactly as I expected, with the changes I made in my browser. However, on my Node backend, I log the object as it was received in the PUT request, and it does not reflect any changes I made in my browser, it looks identical to the original. After I click the button in my browser, the data is reset to its original value. What is going on? Why won’t it send the updated data that I’ve typed in my browser?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:51:02+00:00Added an answer on June 15, 2026 at 5:51 am

    According to your comment:

    Here is console.log($scope.user) from the browser after I edited the form and hit Save (which calls saveUser):

    {__v:0, _id:"50b1a966c12ef0c426000007", password:"NEW MODIFIED PASSWORD"}
    

    And here’s what Node logs as console.log(req.user):

    {__v:0, _id:"50b1a966c12ef0c426000007", password:"originalPassword"})
    

    req.user is usually an object attached to the request object to specify who the currently logged in user is, and is usually managed by middleware. Since you’re doing a PUT request, you’re looking for data in req.body.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the code in a function I'm trying to revise. This example works
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
Here's what I'm trying to accomplish with this program: a recursive method that checks
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
Here's my function: static Map AddFormation(Map _map, Tile tile, int x, int y, int
Here is my javascript code for a cursor focus function to go to username
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here are some facts about my app followed by a question My app has
Here is the scenario: I'm writing an app that will watch for any changes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.