發表文章

目前顯示的是 7月, 2015的文章

Failed to run ionic plugin with node.js 0.12.x

Failed to run ionic plugin with node.js 0.12.x Scenrio: npm http GET https://registry.npmjs.org/cordova-plugin-geolocation TypeError: Request path contains unescaped characters.     at new ClientRequest (_http_client.js:73:11)     at TunnelingAgent.exports.request (http.js:49:10)     at TunnelingAgent.createSocket (C:\Users\cst548\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node _modules\tunnel-agent\index.js:117:25)     at TunnelingAgent.createSecureSocket [as createSocket] (C:\Users\cst548\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\n ode_modules\request\node_modules\tunnel-agent\index.js:184:41)     at TunnelingAgent.addRequest (C:\Users\cst548\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npm\node_modules\request\node_m odules\tunnel-agent\index.js:80:8)     at new ClientRequest (_http_client.js:154:16)     at Object.exports.request (htt

Make phone call with Cordova for Hybrid application

Make phone call with Cordova for Hybrid application Method 1: tel: protocol (open a native dialer) With regular HTML hyperlink element: Call me or using angularjs directive: Call me Add the explicit whitelist permission on config.xml < access origin = "tel:*" launch-external = "yes" /> < access origin = "mailto:*" launch-external = "yes" /> Cordova Whitelist Guide Method 2: Cordova Plugin CordovaCallNumberPlugin Call a number directly from your cordova application. Install the plugin using: cordova plugin add https : //github.com/Rohfosho/CordovaCallNumberPlugin.git Use the plugin in your JS file: window . plugins .CallNumber.callNumber(onSuccess, onError , number); Make sure to create onSuccess and onError call back functions. Reference:  https://github.com/rohfosho/CordovaCallNumberPlugin

Disable ionic's sidemenu content drag to toggle menu

Disable ionic's sidemenu content drag to toggle menu  Associate the state with a controller: $stateProvider . state ( 'app' , { url : "/app" , abstract : true , templateUrl : "pages/menu.html" , controller : 'MenuController' }) Run the config when the view is completelly loaded: . controller ( 'MenuController' , function ($scope, $ionicSideMenuDelegate){ $scope. $on ( '$ionicView.loaded' , function (){ $ionicSideMenuDelegate.canDragContent( false ); }); })

Ionic CLI Guide

Install the Ionic CLI npm install -g ionic Update Ionic lib ionic lib update bower update Starting an Ionic App ionic start -a [appName] [path] - t [ template(tabs|sidemenu|blank) ] Testing in a Browser ionic serve [ options ] ionic serve --lab ( Ionic Lab is a feature on top of  ionic serve  that makes it easy to test your app in a phone frame and with iOS and Android platforms side-by-side. ) Specifying an IP Address to use ionic serve --address 68.54.96.105 Adding a platform target ionic platform ios android Building your app ionic build ios Live Reload App During Development (beta) The  run  or  emulate  command will deploy the app to the specified platform devices/emulators. You can also run  live reload  on the specified platform device by adding the  --livereload  option. The live reload functionality is similar to  ionic serve , but instead of developing and debugging an app using a standard browser, the compiled