cordova - getting error to setup ngcordova firsttime -


i using below code:

<html> <head>     <!--     customize policy fit own app's needs. more guidance, see:         https://github.com/apache/cordova-plugin-whitelist/blob/master/readme.md#content-security-policy     notes:         * gap: required on ios (when using uiwebview) , needed js->native communication         * https://ssl.gstatic.com required on android , needed talkback function         * disables use of inline scripts in order mitigate risk of xss vulnerabilities. change this:             * enable inline js: add 'unsafe-inline' default-src     -->      <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *">     <meta name="format-detection" content="telephone=no">     <meta name="msapplication-tap-highlight" content="no">     <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">     <link rel="stylesheet" type="text/css" href="css/index.css">     <script type="text/javascript" src="js/angular.min.js"></script>     <script type="text/javascript" src="js/ng-cordova.min.js"></script>     <script type="text/javascript" src="cordova.js"></script>      <script> var app = angular.module('myapp', ['ngcordova']); app.controller('myctrl', function($scope, $cordovadevice) {   alert("fgf); }) </script> </head> 

<div ng-app="myapp" ng-controller="myctrl">    k </div>  </body> </html> 

and during runtime getting below error. please guide me how fix it.

      "[info:console(47)] "received event: deviceready", source:       file:///android_asset/www/js/index.js (47)     04-23 11:06:19.444  17043-17043/com.example.hello i/chromium﹕ [info:console(41)] "refused execute inline script because violates following content security policy directive: "default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-eval'". note 'script-src' not explicitly set, 'default-src' used fallback.         ", source: file:///android_asset/www/my.html (41)     04-23 11:06:19.524  17043-17043/com.example.hello i/chromium﹕ [info:console(35)] "uncaught error: [$injector:modulerr] http://errors.angularjs.org/1.3.14/$injector/modulerr?`enter code here`p0=myapp&p1=error%3a%20%5b%24injector%3anomod%5d%20http%3a%2f%2ferrors.angularjs.org%2f1.3.14%2f%24injector%2fnomod%3fp0%3dmyapp%0a%20%20%20%20at%20error%20(......1)", source: file:///android_asset/www/js/angular.min.js (35)" 

the last bullet in comment suggesting change content security policy

 <meta http-equiv="content-security-policy" content="default-src 'self' data: gap: https://ssl.gstatic.com 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; media-src *"> 

to allow inline scripts.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -