發表文章

目前顯示的是 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

Config proxy for npm

The npm config files FILES The four relevant files are: per-project config file (/path/to/my/project/.npmrc) per-user config file (~/.npmrc) global config file ($PREFIX/etc/npmrc) npm builtin config file (/path/to/npm/npmrc) Add the following entries in the config file: proxy=http://proxy.company.com:8080 https-proxy=user:password@http://proxy.company.com:8080 npm 6 way for configuration,priority is listed as following order: Config parameter.  --proxy http://server:port   It set proxy to:  http://server:port . Environment variable。 npm_config_ as the prefix for the environment variable will be recognized as the environment parameter for npm. For example, you can set proxy by:  npm_config_proxy=http://server:port . User configuration document. Please enter  npm config get userconfig  to check the user config path。Mac default path for user is $HOME/.npmrc . Global configuration document. Please enter npm config get globalconfig to check the

NPM Usage

Install a package: node install express https://docs.npmjs.com/cli/install Docs for a package: npm docs express https://docs.npmjs.com/cli/docs Browse an installed package: npm explore express https://docs.npmjs.com/cli/explore List installed packages: npm list https://docs.npmjs.com/cli/lshttps://docs.npmjs.com/cli/ls Uninstall a package: npm uninstall express https://docs.npmjs.com/cli/uninstall Reference: https://docs.npmjs.com/

Using NPM behind proxy

Config NPM behind proxy by config  and proxy or https-proxy : npm config set proxy http://proxy.company.com:8080 npm config set https-proxy http://proxy.company.com:8080 If you want to specify the credential, they can passed by the following URL syntax: http:// username:password @proxy.company.com:8080

NPM Error : ENOENT, stat'C:\Users\username\AppData\Roaming\npm'

Error prompted when using NPM : Error: ENOENT, stat'C:\Users\username\AppData\Roaming\npm' Manually creating a folder named 'npm' in the displayed path fixed the problem.