Converted the JS into TypeScript and Use Restangular for HTTP requests to API.