Currently, I have a factory that utilizes a JSON file wrapped in a $http.get request for testing purposes. However, this approach is not suitable when working within a SharePoint environment where JSON files are restricted. In the end, the goal is to integrate this with a web API call.
How can I define the JSON values within the factory to facilitate testing?
(function() {
var customDataFactory = function($http) {
var factory = {};
factory.getCustomData = function() {
return $http.get('testdata.json');
};
return factory;
};
customDataFactory.$inject = ['$http'];
angular.module('app').factory('dataFactory',
customDataFactory);
}());
Example of JSON data:
[
{
"Segment": "Trading",
"Title": "John Doe",
"Role": "Manager",
"Last Meeting Date": "1/1/2022",
"nextmeetingowner": "",
"CreatedDate": "1/1/2022",
"Modified": "1/1/2022",
"primaryaccountability": "Jane Smith",
"otherltEngaged": "Alice Johnson, Bob Brown",
"upcomingdate": ""
},
{
"Segment": "Finance",
"Title": "Jane Smith",
"Role": "Financial Analyst",
"Last Meeting Date": "12/31/2021",
"nextmeetingowner": "",
"CreatedDate": "1/1/2022",
"Modified": "1/1/2022",
"primaryaccountability": "John Doe",
"otherltEngaged": "Bob Brown, Cindy Davis",
"upcomingdate": ""
},]