ngCordova -
MIT
跨平台
JavaScript
软件简介
ngCordova 包含一组 AngularJS 的表达式,基于
Cordova API 构建,用于简化构建、测试和发布 Cordova 应用。
示例代码:
使用摄像头:
module.controller('PictureCtrl', function($scope, $cordovaCamera) {
$scope.takePicture = function() {
$cordovaCamera.getPicture({
// See all the possible Camera options from the Camera docs [1]:
/// https://github.com/apache/cordova-plugin-camera/blob/master/doc/index.md#cameraoptions
}).then(function(imageData) {
// Success! Image data is here
}, function(err) {
// An error occured. Show a message to the user
});
}
});
条形码扫描:
module.controller('MyCtrl', function($scope, $cordovaBarcodeScanner) {
$cordovaBarcodeScanner.scan().then(function(result) {
// Scanner result }, function(err) {
});