$http.put not updating model
<p>I'm attempting to learn the MEAN stack and learning to use the $http service. </p>

<p>I currently have a global check in place that is suppose to update my Sprints model, which looks like:</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var SprintSchema = new Schema({
  tasks: [{
    type: String,
    ref: 'Task'
  }],
  name: {
    type: String
  },
  start: {
    type: Date
  },
  end: {
    type: Date
  },
  active: Boolean
});</code></pre>
</div>
</div>
</p>

<p>The following controller should update the Sprint model when requested, and when I console.log the variable in my success function, it looks like what I would expect it to pass but it doesn't actually end up updating my model. Below is my code and an example of the console.log. </p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>'use strict';

angular.module('inBucktApp')
  .service('VariableService', function () {
    // AngularJS will instantiate a singleton by calling "new" on this function
        var ticketId = 'noTicketYet';
        var ticketAssigneeName  = 'noTicketNameYet';

        return {
            getPropertyId: function () {
                return ticketId;

            },
            getPropertyName: function () {
                return ticketAssigneeName;

            }
            ,
            setProperty: function(value, valueName) {
                ticketId = value;
                ticketAssigneeName  = valueName;
            }
        };
      })
    .run(['$rootScope', '$http', 'socket', 'VariableService', function($rootScope, $http, socket, VariableService) {

        $rootScope.sprintStart;

        $http.get('/api/sprints').success(function(sprints) {

          $rootScope.sprints = sprints.pop();

          $rootScope.sprintStart = new Date($rootScope.sprints.start);
          $rootScope.sprintEnd = new Date($rootScope.sprints.end);

          socket.syncUpdates('sprints', $rootScope.sprints);


          $http.get('/api/tasks').success(function(task) {
            $rootScope.task = task;
            $rootScope.taskPop = _.flatten($rootScope.task);
            $rootScope.taskPopAgain = $rootScope.task.pop();

            socket.syncUpdates('task', $rootScope.task);
            
        $rootScope.updateTicket = function(){


        //Goes through the entire array and check each element based on critera.
        var taskIdsToAdd = [];

        for(var i = 0; i &lt; $rootScope.taskPop.length; i++){
          var taskFind = $rootScope.taskPop[i];
          //Logic if ticket is not in the sprint
          if ((new Date(taskFind.start) &gt;= $rootScope.sprintStart)  &amp;&amp; (new Date(taskFind.start) &lt;= $rootScope.sprintEnd)){
            taskFind.sprint = true;

            taskIdsToAdd.push(taskFind._id);
            $rootScope.sprints.tasks.push(taskFind._id);

           $http.put("/api/tasks/"+taskFind._id,taskFind).success(function(task){
             console.log('Logic 1 Ran!');
             console.log($rootScope.sprintStart);
            //  socket.syncUpdates('taskPopAgain', taskFindPopAgain);
           });
           $http.put("/api/sprints/"+$rootScope.sprints._id,$rootScope.sprints).success(function(sprints){
             console.log('Logic 2 Ran!');
             console.log($rootScope.sprintStart);
             console.log(sprints)
           });
           console.log($rootScope.sprints);
         } else{
           console.log('this doesnt work first');
         };


         //Logic if ticket is not in the sprint
         if (new Date(taskFind.start) &lt; $rootScope.sprintStart  ||  new Date(taskFind.start) &gt; $rootScope.sprintEnd){
           taskFind.sprint = false;
           $http.put("/api/tasks/"+taskFind._id,taskFind).success(function(task){
             console.log(task);
           });

         }else{
           console.log('this doesnt work');
         };
        }
        };
        $rootScope.updateTicket();
        });
        });
    }]);</code></pre>
</div>
</div>
</p>

<p>Console.Log of console.log(sprints)</p>

<p><a href="https://i.stack.imgur.com/8LbD4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8LbD4.png" alt="Console.Log of console.log(sprints)"></a></p>

<p>Anyone have any idea what I'm doing incorrect here? </p>

<p>Thanks for the help guys. </p>