Categories
front-end

Make an API Request Before Bootstrapping Angular Application

In a recent headless angular application, we needed to make an api request before the application was bootstrapped. Below is a code sample of how it was achieved. This code was placed before the closing <body> tags of an index.html file. (function() { fetchData().then(bootstrapApplication); function fetchData() { var initInjector = angular.injector([“ng”]); var $http = initInjector.get(“$http”); […]