Book Image

AngularJS Web Application Development Blueprints

By : Vinci J Rufus
Book Image

AngularJS Web Application Development Blueprints

By: Vinci J Rufus

Overview of this book

Table of Contents (17 chapters)
AngularJS Web Application Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Building our Add Products page


Now that we have Facebook authentication and the AWS SDK set up, we'll start working on the page to allow users to upload their products for sale.

We start by building our method that will insert the data into the DynamoDB table.

Saving data in DynamoDB tables

Within our AWSservice provider, we will create our new function to save the product data as follows:

saveProductData: function(newProduct) {

    var timestamp = new Date().getTime();
    var UUID = newProduct.userId + "-" + timestamp;
    var productData = {
        Item: {
            'product_id': {S: UUID },
            'category': { S: newProduct.category },
            'title': { S: newProduct.title},
            'description': {S: newProduct.description},
            'price': {N: newProduct.price.toString()},
            'productPicUrl': {S: newProduct.picUrl},
            'userId': {S: newProduct.userId},
            'userName': { S: newProduct.userName}

        }

    };


    dynamo.putItem(productData...