0

I have a django application using AngularJS on the front end.

I have added a function to an AngularJS provider (getByEmployeeId).

app.provider('changeTrackingService', function( CTO_LOCAL_STORAGE_BYTES, MEGABYTE_MULTIPLIER, LOGGED_IN_EMPLOYEE) {



      this.getByEmployeeId = function (employee_id) {
          return httpServ.post('/hr/get_ctm_by_employee', {employee_id: employee_id}).then(function    (resp) {
              return objectModel(resp.data.object_id, resp.data.changeset);
          });
      }

      this.getByEncounterId = function (encounter_id) {
          return httpServ.post('/encounters/get_ctm_by_encounter', {encounter_id: encounter_id}).then(function (resp) {
              return objectModel(resp.data.object_id, resp.data.changeset);
          });
      }

    this.$get = function ($http) {
  httpServ = $http;
        return {
getByEmployeeId: this.getByEmployeeId,
            getByEncounterId: this.getByEncounterId,
            getByOrderId: this.getByOrderId
        }
    }


When I try to run that provider function from a function int he service, nothing happens. The existing function, getByEncounterId works completely fine. But, getByEmployeeId does absolutely nothing. No errors... everything just stops right then.

app.service('chartProvider', ['$http', 'changeTrackingService', function($http, changeTrackingService){
   return {
      get: function(entity_id, isEmployee = false) {
         if(isEmployee)
            return changeTrackingService.getByEmployeeId(entity_id).then(function (object) {
                  return object;
            });
         else
            return changeTrackingService.getByEncounterId(entity_id).then(function (object) {
                  return object;
            });
      },

If I look at the changeTrackingService while debugging, this it is showing the function is there.

{getByEmployeeId: ƒ, getByEncounterId: ƒ, getByOrderId: ƒ}

If I look at the .js file in the browser, the function is there.

If I change it to incorrectly run getByEncounterId it works fine.

I have tried clearing caches, rebuilding docker images, re-collecting static files and spinning around in my chair three times while cutting a potato in half.

0 Answers0