Come si crea un app Chrome, abbiamo messo gli script sulla proprietà di sfondo nella manifest.json file di (questo servirà come sfondo della pagina/evento dell'app). Quello che voglio è, voglio usare AngularJS su script di sfondo ma non so come. E inoltre, è possibile? Ho appena visto some answer ma è per le estensioni di Chrome. Ho provato ad usare questa soluzione nell'app chrome ma non ha funzionato.Chrome Packaged App - Usare AngularJS nella pagina di sfondo/evento
--EDIT--
Quello che ho fatto è stato, ho cambiato un po 'da file manifest.json
da questo ..
"app": {
"background": {
"scripts": ["assets/js/background.js"]
}
},
a questo ..
"app": {
"background": {
"page": "views/background.html"
}
},
e il mio background.html
<html ng-app="backgroundModule" ng-csp>
<head>
<meta charset="UTF-8">
<title>Background Page (point background property here to enable using of angular in background.js)</title>
</head>
<body>
<!-- JAVASCRIPT INCLUDES -->
<script src="../assets/js/vendor/angular1.2.min.js"></script>
<script src="../assets/background.js"></script>
</body>
</html>
ei miei background.js
var backgroundModule = angular.module('backgroundModule', []);
backgroundModule.run(function($rootScope, $http) {
$rootScope.domain = 'http://localhost/L&D/index.php';
console.log($rootScope.domain);
});
Ma ancora ho ottenuto un errore. e dice
" Resource interpreted as Script but transferred with MIME type text/html: "chrome-extension://pdknlhegnpbgmbejpgjodmigodolofoi/views/background.html"
da quando hai fatto un commento nella risposta a quel post che includeva un errore, forse potresti aggiungere l'errore alla tua domanda? – Claies
Non riesco a vedere un problema reale in questa domanda. – Xan
Potrebbe voler controllare http://stackoverflow.com/questions/3467404/chrome-says-resource-interpreted-as-script-but-transferred-with-mime-type-text –