{"id":264,"date":"2014-12-04T11:00:00","date_gmt":"2014-12-04T11:00:00","guid":{"rendered":"http:\/\/localhost\/?p=264"},"modified":"2017-01-09T07:04:59","modified_gmt":"2017-01-09T07:04:59","slug":"moving-forward-with-ngcordova","status":"publish","type":"post","link":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova","title":{"rendered":"Moving Forward with ngCordova"},"content":{"rendered":"<p><em>This is a guest post by <a href=\"http:\/\/paolobernasconi.com\/\">Paolo Bernasconi<\/a>, lead developer on <a href=\"http:\/\/ngcordova.com\/\">ngCordova<\/a>.<\/em><\/p>\n<p>To watch <a href=\"http:\/\/ngcordova.com\/\">ngCordova<\/a> grow from a small idea to a popular open source project with over 1250 stars on GitHub has been a great pleasure for me. Since its inception in July 2014, I&#8217;ve had the opportunity to learn about creating and maintaining a GitHub repository, and I&#8217;ve come to realize the true power of the open source community and individual contributors. With the community&#8217;s troubleshooting help and submissions, we&#8217;ve been able to improve ngCordova more rapidly and effectively than one person, or even a small team, ever could.<\/p>\n<p>When we first built ngCordova, it covered 14 basic Cordova plugins. Now it has <strong>47<\/strong> and counting, ranging from Push Notifications to Facebook support. We have since released 8 versions, received 230 pull requests from 49 contributors, and resolved over 170 issues.<\/p>\n<p><!--more--><\/p>\n<h3 id=\"sowhatsnext\">So, what&#8217;s next?<\/h3>\n<p>The first new feature in ngCordova&#8217;s future is an automatic <code>deviceready<\/code> check to determine whether a device is ready to use plugins. Currently, the only way to ensure this is to manually insert plugin calls inside the event-listener:<\/p>\n<pre><code>document.addEventListener(&quot;deviceready&quot;, function () {\n  $cordovaPlugin.someFunction().then(success, error);\n}, false);\n\n\/\/ OR with Ionic\n\n$ionicPlatform.ready(function() {\n  $cordovaPlugin.someFunction().then(success, error);\n});\n<\/code><\/pre>\n<p>This <em>&#8220;event check&#8221;<\/em> needs to be done for each plugin method, which becomes a bit tedious and over-bloats code in the controller. Soon, ngCordova will call the <code>deviceready<\/code> event in the background, making it easier and simpler to use plugins.<\/p>\n<p>Another important feature on the roadmap is an improved demo app. Cordova plugins can often be very hard to use, and there are times when you might have no idea why your app isn&#8217;t working or what error is being produced. While the <a href=\"https:\/\/github.com\/driftyco\/ng-cordova\/tree\/master\/demo\/www\/app\">current demo<\/a> does include quite a few plugins, we plan to support <em>all<\/em> plugins in ngCordova, with very detailed examples and unit-tests.<\/p>\n<p>Finally, we understand the need for great documentation, so we are improving the docs with more comprehensive methods for each plugin API (<a href=\"http:\/\/ngcordova.com\/docs\/#Facebook\">see the Facebook plugin for an example<\/a>), so you&#8217;ll have all the information you need readily available.<\/p>\n<h3 id=\"whatabouttestinginthebrowser\">What about testing in the browser?<\/h3>\n<p>One of the biggest issues with app development using Cordova plugins is the fact that it can sometimes break an app when testing in the browser, giving us the &#8220;white screen of death&#8221;. ngCordova does have a <a href=\"https:\/\/github.com\/driftyco\/ng-cordova\/tree\/master\/src\/mocks\">mocks module<\/a>, but it requires a lot of extra code in your controller to simulate the phone environment and isn&#8217;t well documented at the moment.<\/p>\n<p>That&#8217;s why I created a Google Chrome extension called <a href=\"https:\/\/chrome.google.com\/webstore\/detail\/cordova-mocks\/iigcccneenmnplhhfhaeahiofeeeifpn\">Cordova Mocks<\/a> (<a href=\"https:\/\/github.com\/pbernasconi\/chrome-cordova\">Github<\/a>), which generates mock-data and automatically injects it into your browser. It follows the same API that Cordova plugins use, so the only thing you have to do is install the extension and start using your app as if you were testing on your phone.<\/p>\n<p>It currently supports the following plugins, with many more to come:<\/p>\n<ul>\n<li>Camera<\/li>\n<li>Device Motion<\/li>\n<li>Device Orientation<\/li>\n<li>Device<\/li>\n<li>Dialogs<\/li>\n<li>Flashlight<\/li>\n<li>Geolocation<\/li>\n<li>Globalization<\/li>\n<li>Network Information<\/li>\n<\/ul>\n<p>Soon, you&#8217;ll be able to configure the data yourself in an options panel built into the extension. Also, expect a Firefox (and maybe Safari) extension in the next few weeks.<\/p>\n<h3 id=\"conclusion\">Conclusion<\/h3>\n<p>ngCordova is still growing day by day and always welcomes new ideas and plugins. If you encounter any issues or want to get official support for a specific plugin, <a href=\"https:\/\/github.com\/driftyco\/ng-cordova\/issues\/new\">create a new issue<\/a>, and stay tuned for new features and fixes.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a guest post by Paolo Bernasconi, lead developer on ngCordova. To watch ngCordova grow from a small idea to a popular open source project with over 1250 stars on GitHub has been a great pleasure for me. Since its inception in July 2014, I&#8217;ve had the opportunity to learn about creating and maintaining [&hellip;]<\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"publish_to_discourse":"","publish_post_category":"","wpdc_auto_publish_overridden":"","wpdc_topic_tags":"","wpdc_pin_topic":"","wpdc_pin_until":"","discourse_post_id":"","discourse_permalink":"","wpdc_publishing_response":"","wpdc_publishing_error":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[3],"class_list":["post-264","post","type-post","status-publish","format-standard","hentry","category-all","tag-ionic"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v23.0 (Yoast SEO v23.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Moving Forward with ngCordova - Ionic Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moving Forward with ngCordova\" \/>\n<meta property=\"og:description\" content=\"This is a guest post by Paolo Bernasconi, lead developer on ngCordova. To watch ngCordova grow from a small idea to a popular open source project with over 1250 stars on GitHub has been a great pleasure for me. Since its inception in July 2014, I&#8217;ve had the opportunity to learn about creating and maintaining [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\" \/>\n<meta property=\"og:site_name\" content=\"Ionic Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-04T11:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2017-01-09T07:04:59+00:00\" \/>\n<meta name=\"author\" content=\"Paolo Bernasconi\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:site\" content=\"@ionicframework\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Paolo Bernasconi\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#article\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\"},\"author\":{\"name\":\"Paolo Bernasconi\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/a7c25bf00aaf44bf98e87bb5afb8c035\"},\"headline\":\"Moving Forward with ngCordova\",\"datePublished\":\"2014-12-04T11:00:00+00:00\",\"dateModified\":\"2017-01-09T07:04:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\"},\"wordCount\":552,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"keywords\":[\"Ionic\"],\"articleSection\":[\"All\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\",\"url\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\",\"name\":\"Moving Forward with ngCordova - Ionic Blog\",\"isPartOf\":{\"@id\":\"https:\/\/ionic.io\/blog\/#website\"},\"datePublished\":\"2014-12-04T11:00:00+00:00\",\"dateModified\":\"2017-01-09T07:04:59+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/ionic.io\/blog\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moving Forward with ngCordova\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/ionic.io\/blog\/#website\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"name\":\"ionic.io\/blog\",\"description\":\"Build amazing native and progressive web apps with the web\",\"publisher\":{\"@id\":\"https:\/\/ionic.io\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/ionic.io\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/ionic.io\/blog\/#organization\",\"name\":\"Ionic\",\"url\":\"https:\/\/ionic.io\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png\",\"width\":1920,\"height\":854,\"caption\":\"Ionic\"},\"image\":{\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/ionicframework\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/a7c25bf00aaf44bf98e87bb5afb8c035\",\"name\":\"Paolo Bernasconi\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/05\/paolo-150x150.jpeg\",\"contentUrl\":\"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/05\/paolo-150x150.jpeg\",\"caption\":\"Paolo Bernasconi\"},\"url\":\"https:\/\/ionic.io\/blog\/author\/pbernasconi\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Moving Forward with ngCordova - Ionic Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova","og_locale":"en_US","og_type":"article","og_title":"Moving Forward with ngCordova","og_description":"This is a guest post by Paolo Bernasconi, lead developer on ngCordova. To watch ngCordova grow from a small idea to a popular open source project with over 1250 stars on GitHub has been a great pleasure for me. Since its inception in July 2014, I&#8217;ve had the opportunity to learn about creating and maintaining [&hellip;]","og_url":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova","og_site_name":"Ionic Blog","article_published_time":"2014-12-04T11:00:00+00:00","article_modified_time":"2017-01-09T07:04:59+00:00","author":"Paolo Bernasconi","twitter_card":"summary_large_image","twitter_creator":"@ionicframework","twitter_site":"@ionicframework","twitter_misc":{"Written by":"Paolo Bernasconi","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#article","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova"},"author":{"name":"Paolo Bernasconi","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/a7c25bf00aaf44bf98e87bb5afb8c035"},"headline":"Moving Forward with ngCordova","datePublished":"2014-12-04T11:00:00+00:00","dateModified":"2017-01-09T07:04:59+00:00","mainEntityOfPage":{"@id":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova"},"wordCount":552,"commentCount":2,"publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"keywords":["Ionic"],"articleSection":["All"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#respond"]}]},{"@type":"WebPage","@id":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova","url":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova","name":"Moving Forward with ngCordova - Ionic Blog","isPartOf":{"@id":"https:\/\/ionic.io\/blog\/#website"},"datePublished":"2014-12-04T11:00:00+00:00","dateModified":"2017-01-09T07:04:59+00:00","breadcrumb":{"@id":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/ionic.io\/blog\/moving-forward-with-ngcordova#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/ionic.io\/blog"},{"@type":"ListItem","position":2,"name":"Moving Forward with ngCordova"}]},{"@type":"WebSite","@id":"https:\/\/ionic.io\/blog\/#website","url":"https:\/\/ionic.io\/blog\/","name":"ionic.io\/blog","description":"Build amazing native and progressive web apps with the web","publisher":{"@id":"https:\/\/ionic.io\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/ionic.io\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/ionic.io\/blog\/#organization","name":"Ionic","url":"https:\/\/ionic.io\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2020\/10\/white-on-color.png","width":1920,"height":854,"caption":"Ionic"},"image":{"@id":"https:\/\/ionic.io\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/ionicframework"]},{"@type":"Person","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/a7c25bf00aaf44bf98e87bb5afb8c035","name":"Paolo Bernasconi","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/ionic.io\/blog\/#\/schema\/person\/image\/","url":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/05\/paolo-150x150.jpeg","contentUrl":"https:\/\/ionic.io\/blog\/wp-content\/uploads\/2015\/05\/paolo-150x150.jpeg","caption":"Paolo Bernasconi"},"url":"https:\/\/ionic.io\/blog\/author\/pbernasconi"}]}},"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/264","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/comments?post=264"}],"version-history":[{"count":0,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/posts\/264\/revisions"}],"wp:attachment":[{"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/media?parent=264"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/categories?post=264"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ionic.io\/blog\/wp-json\/wp\/v2\/tags?post=264"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}