ngcordova

ionic 添加 ngCordova

允我心安 提交于 2020-04-06 08:26:53
ngCordova使用很简单, 首先在项目目录下 ,使用bower工具安装 bower install ngCordova 然后将ng-cordova.js或者ng-cordova.min.js添加到index.html中的cordova.js引入之前 <script src="lib/ngCordova/dist/ng-cordova.js"></script> <script src="cordova.js"></script> 在js中添加ngCordova依赖 angular.module('myApp', ['ngCordova']) 在使用每个插件之前,必须先检测设备是否就绪   $ionicPlatform.ready(function() {     $cordovaPlugin.someFunction().then(success, error);   }); 来源: https://www.cnblogs.com/xindejiyi/p/5603099.html

ionic项目之ngcordova插件之camera

只谈情不闲聊 提交于 2020-04-06 07:20:32
参考文章 https://github.com/driftyco/ng-cordova http://ngcordova.com/docs/plugins/camera/ 官方解释是既可以用来拍照也可以录视频(只试用了拍照功能) 首先 ,装插件 cordova plugin add org.apache.cordova.camera 然后 ,如果之前配置过ngcordova的话,就直接在控制器加上$cordovaCamera就好了 有两种方法获取拍照得到的图片 1,拍照返回64位的图片数据(destinationType: Camera.DestinationType.DATA_URL) 2,拍照返回图片文件的实际存储地址(destinationType: Camera.DestinationType.FILE_URI) 1,拍照返回64位的图片数据(成功了,可是图片数据即使100%的质量也很不清晰) var options = { quality: 50, destinationType: Camera.DestinationType.DATA_URL, sourceType: Camera.PictureSourceType.CAMERA, allowEdit: true, encodingType: Camera.EncodingType.JPEG, targetWidth:

Cordova In App Browser event not firing IOS

寵の児 提交于 2020-01-15 07:37:08
问题 Trying to authenticate users on my ionic application through an external service and I need to use cordovas In app browser! The code works perfectly on android however on iOS the "loadstop" event never fires and thus, the browser never redirects itself back to the application. The code I have looks like this: $rootScope.$on('$cordovaInAppBrowser:loadstop', function (e, event) { console.log('inappbrowser loaded', event); var regex = /* regex to determine if url is correct redirected url */ var

Grunt task wiredp is not injecting ngcordova

你。 提交于 2020-01-07 06:36:52
问题 I have the following task writtenm in grunt , which removes ngCordova from index.html. How do I correct it? // Automatically inject Bower components into the app wiredep: { app: { src: ['<%= yeoman.app %>/index.html'], ignorePath: /\.\.\// }, test: { devDependencies: true, src: '<%= karma.unit.configFile %>', ignorePath: /\.\.\//, fileTypes:{ js: { block: /(([\s\t]*)\/{2}\s*?bower:\s*?(\S*))(\n|\r|.)*?(\/{2}\s*endbower)/gi, detect: { js: /'(.*\.js)'/gi }, replace: { js: '\'{{filePath}}\',' }

$cordovaFile method does nothing when called?

给你一囗甜甜゛ 提交于 2020-01-06 02:14:15
问题 I'm trying to use the ngCordova plugins in my Ionic app, but I can't seem to get them working properly. Here is my Controller : .controller('InspectionCtrl', ['$scope', '$stateParams', '$cordovaDevice', '$ionicPlatform', '$cordovaFile', function($scope, $stateParams, $cordovaDevice, $ionicPlatform, $cordovaFile){ document.addEventListener("deviceready", function () { //When save button is clicked, call this function $scope.save = function() { $cordovaFile.writeFile(cordova.file.dataDirectory,

Is Ionic Framework resolveLocalFileSystemURL Asynchronous?

若如初见. 提交于 2020-01-03 21:09:41
问题 I am calling a function from my AngularJS controller. When the function completes execution, I would like to print the result after the function call. This code is inside the controller, which is called on-tap //count the number of files inside a directory var count = countDir(cordova.file.dataDirectory +'/Images/'); console.log('Hello '); console.log('Count of directory '+count); Here is the countDir function. This function finds the number of files in a directory and then returns the count

How to programmatically enable and disable GPS in Ionic Framework or Cordova

天大地大妈咪最大 提交于 2020-01-02 06:42:20
问题 My problem is simple. I need a way to turn on and off GPS using a button inside an Ionic app. I've check the docs and read this ng-cordova plugin http://ngcordova.com/docs/plugins/geolocation/ but they don't seem have this funcction. Am I just missing something or is this even possible in Ionic Framework? Thanks! 回答1: As far as I'm aware there isn't the ability to directly disable GPS from your app. If you are trying to allow the user to disable GPS, I achieved this by adding a setting to

Ionic app image upload from camera / photo library

萝らか妹 提交于 2019-12-29 03:11:31
问题 I'm working on a ionic chat app where the user can upload a photo as part of their message. I'm looking for a way to upload the image to my webhost server so I can retrieve it later via a URL. The problem is that I'm not able to get it to upload to my web server. I'm using these two plugins: org.apache.cordova.file-transfer cordova-plugin-camera When I run the app in xcode simulator and select a picture from the device photolibrary, the console gives me the following messages: File Transfer

Store image to Firebase storage from cordova camera plugins on Ionic

拜拜、爱过 提交于 2019-12-25 09:11:31
问题 I've red some topics on the subject (e.g: Uploading image to Firebase Storage from Cordova app) but didn't find my answer... I'm working on a IONIC project with the implementation of the ngCordova camera plugin to take picture and get pic from the librairy. So I got the result as a image URI and I want to upload it in Firebase storage (as file or Blob). Here is my code : $scope.fromCamera = function() { $ionicPlatform.ready(function() { var options = { quality: 75, destinationType: Camera

The BarcodeScanner plugin in ngCordova doesnt work in Android 6

爱⌒轻易说出口 提交于 2019-12-25 07:40:33
问题 I'm developing in Ionic Framework.The barcodeScanner plugin(ngCordova) doesn't work for the newest version of Android. I suspect the plugin is not updated for this version. Any of you have found a solution? Thanks. 回答1: Samuel Paredes, There is many change in Android 6(M) , the main is runtime permissions, so we need the camera for the barcode scanner , but the plugin is not yet updated for that so we need to On the Camera permisson for the application manuully. Setting >> APP manager >> Your