AngularJS from a Chrome Extension background script
Thanks for the input @Xan, @harish - based on your feedback did some more investigation and have the solution. In essence, instead of pointing to a background script in the Chrome manifest, I am pointing to a background HTML page, which I then use to bootstrap my Angular app. The relevent code:
manifest.json:
..."background": { "page": "/app/background.html"}...
background.html
<!DOCTYPE html><html lang="en" ng-app="MyApp" ng-csp> <head> <title>Background Page</title> <meta charset="UTF-8"> <script type="text/javascript" src="/app/components/angular/angular.js"></script> <script type="text/javascript" src="/app/scripts/background.js"></script> </head> <body></body></html>
background.js
var app = angular.module('MyApp', []);app.run(function() { console.log('Hello world');});