Summary
In this chapter, you learned about two different XHR techniques to load external data for the visualization: d3.xhr with D3.js and $http with AngularJS. If we include an already existing chart application in the AngularJS application, we can wrap the D3.js loading component into a service. In order to test this component, we need to write asynchronous unit tests.
If we write the visualization from scratch, we'd better implement the data loading technique with the $http module of Angular JS. This allows you to mock the behavior of $httpBackend and automatically serve data for specified routes. With this method, we can continue to write synchronous tests, which are more readable and expressive.
In the second part of this chapter, we parsed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access