我刚开始使用phonegap学习angularJS,我有一个简单的HTML代码和几行angularjs代码。浏览器中的一切正常,但当我尝试在Android手机上运行时,只有HTML代码才能在手机屏幕中运行。为什么呢?
$sql="INSERT INTO usuario (login,password,email,sex,age,phone,country,city,address)
VALUES('$login','$password','$password','$email','$sex','$age','$country','$city','$address')";
$result=mysqli_query($con,$sql);
这是JS代码:
<!DOCTYPE html>
<html>
<script src="C:\Users\Ghaith Haddad\Desktop\learning\learn\angular-1.5.8"></script>
<script src="C:\Users\Ghaith Haddad\Desktop\learning\learn\www\me.js"></script>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>AngularJS Tutorial</title>
</head>
<body>
<script type="text/javascript" src="cordova.js"></script>
<div ng-app="app3" ng-controller="ctrl1">
<span>Values:</span>
<input type="text" ng-model="first" />
<input type="text" ng-model="second" />
<h1>hello there buddy</h1>
<button ng-click="update()">Sum</button>
<br><br>
{{calculation}}
</div>
<script>
var app = angular.module('app3', []);
app.controller('ctrl1', function($scope) {
$scope.first = 1;
$scope.second = 2;
$scope.update = function(){
$scope.calculation = (+$scope.first + +$scope.second);
};
});
<!-- Load the AngularJS library -->
</script>
<!-- Load the JS Module -->
</body>
</html>
答案 0 :(得分:1)
使用cordova的相对路径(例如&#34; ./")而不是绝对路径( ),这种脚本无法加载的方式。无论如何,你可以使用chrome调试你的解决方案,并使用safari检查器附加设备或iOS。
示例:
<!DOCTYPE html>
<html>
<head>
<base href=".">
</head>
<body>
<script type="text/javascript" src="bundle.js"></script>
</body>
</html>