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
Arrow up icon
GO TO TOP
AngularJS Web Application Development Blueprints

You're reading from   AngularJS Web Application Development Blueprints A practical guide to developing powerful web applications with AngularJS

Arrow left icon
Product type Paperback
Published in Aug 2014
Publisher Packt
ISBN-13 9781783285617
Length 300 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Vinci J Rufus Vinci J Rufus
Author Profile Icon Vinci J Rufus
Vinci J Rufus
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Introduction to AngularJS and the Single Page Application FREE CHAPTER 2. Setting Up Your Rig 3. Rapid Prototyping with AngularJS 4. Using REST Web Services in Your AngularJS App 5. Facebook Friends' Birthday Reminder App 6. Building an Expense Manager Mobile App 7. Building a CMS on the MEAN Stack 8. Scalable Architecture for Deployments on AWS 9. Building an E-Commerce Store A. AngularJS Resources Index

Adding a Facebook login


Using the Facebook JavaScript SDK, we are going to create our very own directive for the Facebook login. We could simply copy and paste the sample Facebook login code available on the developer portal into our index.html file, and it would just work. However, this wouldn't be a clean approach. Instead, using directives helps to make the code abstract, thus keeping it clean, and once you have your own directive, it becomes quite easy to add the Facebook login into any of your other projects.

Now, let's try and get our Facebook login to work.

Adding the fb-root div element

Whenever we use the JavaScript SDK for Facebook, it's important that we have an empty <div> element with an ID named fb-root just after the <body> tag. The SDK uses this <div> element to insert other elements as needed.

Let's open up our app/index.html file and add the following highlighted <div> element:

<body>
    <div id="fb-root"></div>

In case you don't create...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image