2
我不知道为什么,但$范围不起作用的相机回调。 (的onSuccess功能)AngularJS + PhoneGap相机 - 我怎样才能获得成功的范围
HTML
<button ng-click="capturePhoto();">Capture</button>
<span>{{ test }}</span>
JAVASCRIPT
app.controller('myController', function($scope, $http) {
$scope.capturePhoto = function(){
$scope.test = "test 1";
navigator.camera.getPicture(onSuccess, onFail, { quality: 50,
destinationType: Camera.DestinationType.DATA_URL });
}
function onSuccess(imageData) {
var image = imageData;
alert($scope); // [object Object]
alert($scope.test); // test1
$scope.test = "test 2"; // Problem: do not show on screen
alert($scope.test); // test2
}
});
的页面仍呈现TEST1。难道我做错了什么?有没有最好的方法来做到这一点?
感谢
我只是尝试的第一个选项,并担任一个魅力。我会在稍后尝试第二个选项。 – guinatal 2015-03-13 16:32:29