Reputation: 11
I have an AngularJS app which I'm running on Cordova (Android). It connects to a Firebase DB and pushes an object.
It works well in Chrome and it works in Cordova (Android). However, on Android, if I click on the textarea which brings up the keyboard the object is not longer pushed to Firebase.
Does anyone know what's wrong?
<html ng-app>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.13/angular.min.js"></script>
<script src='https://cdn.firebase.com/js/client/1.0.17/firebase.js'></script>
<meta charset=utf-8 />
<title>Angular JS Demo</title>
</head>
<body ng-controller="ctrl">
<h1>Comments</h1>
<div class="row">
<div class="small-12 columns">
<form novalidate>
<textarea placeholder="Add comment" ng-model="comment.text"></textarea>
<button type="submit" class="tiny button pull-right" ng-click="addTestComment(comment)">Add Comment</button>
</form>
</div>
</div>
</div>
<script type="text/javascript">
var firebase_url = "https://<secret>.firebaseio.com";
function ctrl($scope){
$scope.comment = {'text':'Placeholder comment'};
$scope.addTestComment = function(comment) {
var cmt = {'text':'Test Comment 1', 'created':new Date().getTime()};
cmt.text = comment.text;
var ref = new Firebase(firebase_url).child('comments-test');
ref.push(cmt);
};
}
</script>
</body>
</html>
Upvotes: 0
Views: 269
Reputation: 11
I forgot to include cordova.js in my HTML. Including it solves the problem:
<script src="cordova.js"></script>
Upvotes: 1