The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.



In his debut lesson, Trevor **test drives** the transformation of a response from an external REST service using the the `transformResponse` option of AngularJS's `$http` service.
Watch this lesson now

In his debut lesson, Trevor test drives the transformation of a response from an external REST service using the the transformResponse option of AngularJS's $http service.


Good lesson! It would be helpful to also have the karma.conf.js file listed. I'm having trouble getting the modules to be loaded in the spec whether I run it in WebStorm or from the command line for this example. I have added all the JS files in the karma.conf.js script.

In reply to

Here's the karma.conf.js:

// Karma configuration
// Generated on Sun Oct 27 2013 16:05:49 GMT-0400 (EDT)

module.exports = function (config) {

       // base path, that will be used to resolve files and exclude
       basePath: '',

       // frameworks to use
       frameworks: ['jasmine'],

       // list of files / patterns to load in the browser
       files: [

       // list of files to exclude
       exclude: [


       preprocessors: {
           'app/**/*.html': ['ng-html2js']

       ngHtml2JsPreprocessor: {
           moduleName: 'templates'

       // test results reporter to use
       // possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
       reporters: ['progress'],

       // web server port
       port: 9876,

       // enable / disable colors in the output (reporters and logs)
       colors: true,

       // level of logging
       // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
       logLevel: config.LOG_INFO,

       // enable / disable watching file and executing tests whenever any file changes
       autoWatch: true,

       // Start these browsers, currently available:
       // - Chrome
       // - ChromeCanary
       // - Firefox
       // - Opera (has to be installed with `npm install karma-opera-launcher`)
       // - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
       // - PhantomJS
       // - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
       browsers: ['PhantomJS'],

       // If browser does not capture in given timeout [ms], kill it
       captureTimeout: 60000,

       // Continuous Integration mode
       // if true, it capture browsers, run tests and exit
       singleRun: false
In reply to Magnus

I am new to Angular so I wanted to see if this response still brings back the full object or just what you request? I had someone tell me that Angular is not able to parse the object before being sent back. Is this true? I wanted to find out because I don't want to have to make a request and get the full object back if I don't need it all before then parsing. Hope that makes sense.

In reply to

I'm hoping you can clarify something for me.

I'm new at this and I'm just trying to get my head wrapped around it. I'm thinking that when you inject ["$http"], you put the argument as ($http). Why do you inject the transformer into the service using the name services.transformers.ApiResponse and then put the argument as apiResourceTransformer. Why are the names different?

I'm sure this is elementary, so please kindly help this 1st grader out.


In reply to
Ignacio Morales

Can you please share the full example project of this video. It will help a lot to have an overview of this.


Joel's Head
Why are we asking?