Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
PhoneGap and AngularJS for Cross-platform Development
PhoneGap and AngularJS for Cross-platform Development

PhoneGap and AngularJS for Cross-platform Development: Build exciting cross-platform applications using PhoneGap and AngularJS

Arrow left icon
Profile Icon Yuxian E Liang Profile Icon Eugene Liang
Arrow right icon
Can$46.99
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2 (2 Ratings)
Paperback Oct 2014 122 pages 1st Edition
eBook
Can$12.99 Can$37.99
Paperback
Can$46.99
Subscription
Free Trial
Arrow left icon
Profile Icon Yuxian E Liang Profile Icon Eugene Liang
Arrow right icon
Can$46.99
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2 (2 Ratings)
Paperback Oct 2014 122 pages 1st Edition
eBook
Can$12.99 Can$37.99
Paperback
Can$46.99
Subscription
Free Trial
eBook
Can$12.99 Can$37.99
Paperback
Can$46.99
Subscription
Free Trial

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

PhoneGap and AngularJS for Cross-platform Development

Chapter 1. Introduction to AngularJS

Welcome to the world of AngularJS with PhoneGap! In this book, you will learn how to merge two very exciting technologies, namely AngularJS and PhoneGap. By the end of this book, you will have a working mobile app that works across iOS and Android, based on AngularJS and PhoneGap. As mentioned previously, this book is targeted at programmers who have knowledge of PhoneGap, but may or may not have knowledge regarding AngularJS. You should have some idea about JavaScript though, for you to get maximum benefit out of this book. That said, let us begin with AngularJS.

A brief overview of AngularJS

AngularJS (https://angularjs.org/) is a super heroic JavaScript MVC framework, which is maintained by Google. It is open source and its main goal is to assist with creating single page applications. These are typically one-page web applications that only require HTML, CSS, and JavaScript on the client side.

While one may argue that there are already many frameworks out there in the market that help with this issue, I would like to say that AngularJS is different in a few ways. And in quite a few of these instances, it makes your life much easier as a frontend programmer.

Core concepts

There are many concepts related to AngularJS, but I will cover the most commonly used ones for the sake of progressing through this chapter. As we go along in this book, I'll touch on other concepts, such as the use of self-defined directives and performing RESTful requests via AngularJS. The main concepts that you should understand in this section are directives, controllers, and data binding.

Controllers

If you have already used JavaScript frameworks, such as BackBone.js, Can.js, Ember.js, or KnockOut.js, you should be familiar with this concept. Controllers are the behavior behind the DOM elements. AngularJS lets you express the behavior in a clean readable form without the usual boilerplate of updating the DOM, registering callbacks, or watching model changes.

Data-binding

Data-binding is an automatic way to update the view whenever the model changes, as well as updating the model whenever the view changes. The coolest aspect of this concept is that it is a two way data-binding process. Used in tandem with controllers, this can save you a lot of code, as there is no need for you to write the usual updating of the DOM elements.

Directives

Directives are another awesome concept in AngularJS. What they do is teach your application new HTML syntax and new things specific to your application. Directives can be self-defined and predefined. Some of the more notable predefined directives include:

  • ng-app: This declares an element as a root element of the application, allowing its behavior to be modified through custom HTML tags.
  • ng-bind: This automatically changes the text of an HTML element to the value of a given expression.
  • ng-model: This is similar to ng-bind, but allows two-way binding between the view and scope.
  • ng-controller: This specifies a JavaScript controller class, which evaluates HTML expressions. In layman's terms, what ng-controller does is that it applies a JavaScript function to this block of HTML so that this particular JavaScript function (including its accompanying logic, expressions, and more) can only operate in this block of HTML.
  • ng-repeat: You can see this as a loop through a collection.

A conceptual example

Now, let's take a look at how some of the previous concepts play together. Consider the following piece of code:

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>Say Hello World</label>
      <input type="text" ng-model="yourHelloWorld" placeholder="Type anything here.">
      <hr>
      <h1>Hello {{yourHelloWorld}}!</h1>
    </div>
  </body>
</html>

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Let's go through the code.

  • We defined an HTML5 HTML document in this case, as seen in the first line
  • Next, notice ng-app in the second line of the code; this is an AngularJS directive, which tells AngularJS that this is the root of the AngularJS application
  • In order to use AngularJS, we obviously have to install the script on this web page, as shown in the <script> tag
  • Within the body tag, we see a label, an input, and an h1 tag.
  • Take note of the input tag, there is a ng-model directive, which is mapped to h1 tag's {{yourHelloWorld}}
  • What the previous piece of code does is that anything that is typed into the input box, will be shown in place of {{yourHelloWorld}}

Take note of the version of the code we are using in this chapter, version 1.2.12; should you be using newer versions of AngularJS, there is no guarantee that the code will work.

Now that we have briefly walked through the code, let us copy the code and run it on our web browser. Feel free to copy the code and save it as concepts.html. The source code for this chapter can be found in the concepts.html file in the Chapter 1 folder.

Copied the code? If so, open the file in your favorite web browser. You should see the following screenshot in your browser:

A conceptual example

A sample concept web page

Got the previous code? Ok great! So now you can try typing into the input box and see new text being appended to Hello and before ! in the screen.

For instance, when we type world, we will see the new characters being appended to the screen as I continue to type. By the end of typing the word "World", we should see the following screenshot:

A conceptual example

After typing World

Now that we have a brief idea as to how a simple AngularJS app works, let us move to a more complicated app.

A simple to-do list using AngularJS

In this example, we will cover in detail as to how to write code for a slightly more complicated AngularJS app. This app is modified from the official example found at angularjs.org. This example will be used as a base when we convert it from a web application to a PhoneGap application.

Preparing your code structure

For starters, create the index.html and todo.js files. Just for your information, the code found in this section can be found in the todo folder in Chapter 1.

HTML for our to-do list

We need to prepare our HTML file so that we can make use of AngularJS. Similar to the previous concepts.html file, you will see that we have included the use of AngularJS via script. Open up your index.html file in your favorite editor and you can start by adding the following code:

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.12/angular.min.js"></script>
    <script src="todo.js"></script>
    <link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
    <style>
      body {
        padding:40px;
      }
      #todoDetails {
        visibility: hidden;
      }
    </style>
  </head>
  <body>
    <div class="row"  ng-controller="todoCtrl">
      <div class="col-md-6">
        <h2>Todo</h2>
        <div>
          <span>{{getRemaining()}} of {{todos.length}} remaining</span>
          [ <button ng-click="archive()">archive</button> ]
          <ul class="unstyled">
            <li ng-repeat="todo in todos">
              <input type="checkbox" ng-model="todo.done">
              <span class="done-{{todo.done}}">{{todo.text}}</span>
              <button ng-click="showDetail(todo.text)">Detail</button>
            </li>
          </ul>
          <form ng-submit="addTodo()">
            <input type="text" ng-model="todoText"  size="30"
                   placeholder="add new todo here">
            <input class="btn-primary" type="submit" value="add">
          </form>
        </div>
      </div>
      <div id="todoDetails" class="col-md-6" >
        <h2>Details</h2>
        Title: <span id="title">{{currentText}}</span>
        <br>
        Add Details:
        <form ng-submit="addDetails()">
          <textarea id="details" ng-model="currentDetails">{{currentDetails}}</textarea>
          <p>
          <input class="btn-primary" type="submit" value="Add Details">
          <input class="btn-primary" type="submit" value="Cancel" ng-click="closeThis()">
        </p>
        </form>
      </div>
    </div>
  </body>
</html>

Now, to make sure that you are on the same page as I am, I want you to open this file in your favorite browser. You should see something like the following screenshot:

HTML for our to-do list

Our HTML template

Got the previous code? It looks weird now due to the fact that we have not added the main JavaScript functionalities. We will be working on it in the next section.

Now, let me explain the code; notice that I have highlighted a few lines of it. These are the most important lines of the code that you should take note of in this example. The remaining lines are just the usual HTML code.

  • The first two lines of the highlighted code simply install AngularJS and include BootStrap 3's CSS for styling purposes. Without both, the project will not work and may not look good.
  • The ng-controller directive is what we covered briefly earlier on in this chapter. We are applying todoCtrl to this block of HTML.
  • The ng-click directive is another directive that we did not touch on in the previous section. What ng-click does is that it executes whatever function is defined for this directive. In our example, ng-click="archive()" means that on clicking it, archive() will be executed. The JavaScript function archive() is written in our todo.js file, which we will cover later.
  • The ng-repeat directive is a directive that loops through a collection. Notice how we implemented ng-repeat in our HTML code:
    <li ng-repeat="todo in todos">
       <input type="checkbox" ng-model="todo.done">
       <span class="done-{{todo.done}}">{{todo.text}}</span>
       <button ng-click="showDetail(todo.text)">Detail</button>
     </li>

    Anything that is within <li> is dependent on the todo object, which is part of the todos collection.

  • The ng-submit directive is generally used in forms. This is a directive which controls what is being done on the submit form. In this case, on the submit form, we will execute the JavaScript function addToDo().
  • The [] option encapsulates <button ng-click="archive()">archive</button>, which simply adds a square bracket around the button.

Adding in JavaScript with AngularJS

Now we will open our todo.js file, which we created in the previous section. Open todo.js in your favorite text editor. Let us begin by coding the following:

function todoCtrl($scope) {

}

We are first going to define a controller, which we will be using for our app. Notice that we have named it todoCtrl, which is mapped onto ng-controller in the HTML file (index.html), where ng-controller="todoCtrl" means that todoCtrl will be controlling this portion of the web page.

Also, notice the use of $scope, which is an object that refers to the application model; it is the execution context for related expressions, such as ng-click, ng-model, and so on. Any such expressions of a predefined directive outside this scope will not be executed.

Let's start by initializing our to-do list. Within todoCtrl, add the following code:

  $scope.todos = [
    {text:'here is my first to do', done:true, details:''},
    {text:'continue writing chapter 1 for this book', done:false, details:''},
    {text:'work on chapter 2 examples', done:false, details:''}
  ];

  $scope.currentText = ''; // make the text empty
  $scope.currentDetails = ''; // make the text empty

What $scope.todos does is that it simply creates a list of objects, which contains the text, details, and whether this to-do is executed or not (true or false). Notice that todos here is mapped to the collection todos as seen in index.html, where ng-repeat is being used.

Let's move on by adding more functionalities. After $scope.currentDetails, add the following three JavaScript functions:

  $scope.addTodo = function() {
    $scope.todos.push({text:$scope.todoText, done:false, details:''});
    $scope.todoText = '';
  };
 
  $scope.remaining = function() {
    var count = 0;
    angular.forEach($scope.todos, function(todo) {
      count += todo.done ? 0 : 1;
    });
    return count;
  };
 
  $scope.archive = function() {
    var oldTodos = $scope.todos;
    $scope.todos = [];
    angular.forEach(oldTodos, function(todo) {
      if (!todo.done) $scope.todos.push(todo);
    });
  };

The $scope.todoText function resets todoText after it has been pushed into the array. The $scope.addTodo function does what it is suppose to do, simply adding a new to-do to the list of todos as defined earlier. The beauty of AngularJS is that it uses standard JavaScript data structures that make manipulation so much easier.

The $scope.getRemaining function simply calculates the number of items that are not done yet. Here, we can see two-way data-binding in action as this function executes whenever there is a change in the length of todos.

The $scope.archive function marks a to-do as done:true in standard JavaScript manner.

By now, you should have noticed that all the JavaScript functions defined here are being used in index.html under ng-controller="todoCtrl".

Let's now add three more JavaScript functions to complete the finishing touch for this sample application.

After the $scope.archive function, add the following functions:

  $scope.showDetail = function(text) {
    var result = $scope.todos.filter(function (obj) {
      return obj.text == text;
    })
    $scope.currentText = result[0].text;
    $scope.currentDetails = result[0].details;
    document.getElementById('todoDetails').style.visibility = 'visible';
  }

  $scope.closeThis = function() {
    $scope.currentText = '';
    $scope.currentDetails = '';
    document.getElementById('todoDetails').style.visibility = 'hidden';
  }

  $scope.addDetails = function(text) {
    var result = $scope.todos.filter(function (obj) {
      return obj.text == text;
    })
angular.forEach($scope.todos, function(todo) {
      if(todo.text == text) {
        todo.details = $scope.currentDetails;
      }
    });
    document.getElementById('todoDetails').style.visibility = 'hidden';
    
  }

The $scope.showDetail function simply retrieves the current to-do being clicked on and shows it on the div with ID #todoDetails. The visibility of the #todoDetails function is then set to visible.

The $scope.close function simply changes the visibility of #todoDetails to hidden.

Finally, $scope.addDetails adds the details of the todo item, and changes the visibility of #todoDetails to hidden once done.

Okay, so to see if we are on the same page, we now need to check our code. Save this file as todo.js. Refresh your browser and you should still see the same user interface as per the previous screenshot.

Now, try clicking on the Detail button in front of work on chapter 2 examples, and you should see the following screenshot:

Adding in JavaScript with AngularJS

Details of the ToDo item shows on clicking on the corresponding detail button

You will see the details of a particular to-do item. You can try to add some details for this item and click on Add Details. You can then click on other items and come back to this item later (without refreshing the browser), and you should still see the details in the text area.

You can also check off any of the items and you will see that the number of remaining to-do item decreases:

Adding in JavaScript with AngularJS

Number of items changes dynamically as you check off items

And of course, you can add new items by simply typing in the input box and clicking on the add button. You should notice that the number of items now increases:

Adding in JavaScript with AngularJS

Adding new to-dos changes the number of items dynamically and also shows on the screen immediately

Summary

To summarize what we have done in this chapter; we have walked through the basics of building an AngularJS app and familiarized ourselves with the basic concepts used in AngularJS. We have made use of ng-app, ng-controller, ng-click, ng-repeat, and ng-submit in general. These expressions, such as ng-click and ng-submit are typically mapped onto JavaScript functions defined in AngularJS controllers, as seen in todo.js in our example. Notice how little code we have written in order to achieve such speedy UX through the concept of two-way data-binding and its controllers.

In the next chapter, we will start to port this app in a more organized manner to PhoneGap.

Left arrow icon Right arrow icon

Description

PhoneGap is a mobile development framework that allows developers to build cross-platform mobile applications. Building PhoneGap apps is traditionally done using HTML, CSS, jQuery Mobile, Eclipse Editor, and/or Xcode. The process can be cumbersome, from setting up your editor to optimizing your usage of jQuery, and so on. However, AngularJS, a new but highly popular JavaScript framework, eases these tasks with APIs to get access to mobile APIs such as notifications, geo-location, accelerometers, and more. Starting with the absolute basics of building an AngularJS application, this book will teach you how to quickly set up PhoneGap apps using the command-line interface. You will learn how to create simple to advanced to-do lists and add authentication capabilities using PhoneGap's plugins. You will enhance your skills by writing a PhoneGap app using your newly learned AngularJS skills. Furthermore, you will learn about adding animation and interactive designs to your mobile web apps using PhoneGap plugins. By the end of the book, you will know everything you need to launch your app on both Android and iOS devices.

Who is this book for?

This book is intended for people who are not familiar with AngularJS and who want to take their PhoneGap development skills further by developing apps using different JavaScript libraries. People with some knowledge of PhoneGap, HTML, CSS, and JavaScript will find this book immediately useful.

What you will learn

  • Learn about the features of AngularJS and use it to organize your code
  • Create RESTful web apps using AngularJS
  • Reduce the hassle of developing PhoneGap apps using the commandline interface
  • Quickly integrate AngularJS to enhance authentication capabilities via PhoneGap plugins
  • Use AngularJS touch modules to optimize your PhoneGap app
  • Build a crossplatform application with PhoneGap and AngularJS
  • Learn how to use the concepts of twoway data binding and directives along with PhoneGap for mobile application development
Estimated delivery fee Deliver to Canada

Economy delivery 10 - 13 business days

Can$24.95

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Oct 31, 2014
Length: 122 pages
Edition : 1st
Language : English
ISBN-13 : 9781783988921
Category :
Languages :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Canada

Economy delivery 10 - 13 business days

Can$24.95

Product Details

Publication date : Oct 31, 2014
Length: 122 pages
Edition : 1st
Language : English
ISBN-13 : 9781783988921
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 116.98
AngularJS Web Application Development Blueprints
Can$69.99
PhoneGap and AngularJS for Cross-platform Development
Can$46.99
Total Can$ 116.98 Stars icon
Banner background image

Table of Contents

8 Chapters
1. Introduction to AngularJS Chevron down icon Chevron up icon
2. Getting Ready for PhoneGap Chevron down icon Chevron up icon
3. From a Simple To-do List to an Advanced To-do List Chevron down icon Chevron up icon
4. Adding Authentication Capabilities Using PhoneGap Plugins Chevron down icon Chevron up icon
5. Sprucing Up the App Using Animations and Mobile Design Chevron down icon Chevron up icon
6. Getting Ready to Launch Chevron down icon Chevron up icon
A. References Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
(2 Ratings)
5 star 0%
4 star 0%
3 star 0%
2 star 100%
1 star 0%
Amazon Customer Nov 21, 2015
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
I bought the kindle version of the book, but wasted a lot of time trying to figure out why some of the programs weren't working as they should. There were 5 separate mistakes/typos which caused errors or the programs not to run before I had even finished chapter 3. The downloadable content only seems to be available for chapters 1,2 and 5 for some reason which meant I was stumped on chapter 3. The actual book seemed quite useful, but was let down by the mistakes and missing content.
Amazon Verified review Amazon
fabricio Jan 01, 2015
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
Although the book covers the basic steps to create a phonegap application with angular, it doesn't go much further.Certain things such as angular routes, files urls and such aren't covered.It's a nice intro to the subject, but nothing more.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela