How to Share Data Between AngularJS Controllers

| Last Updated: | In: Angular JS, Freebies

There are several ways to share data between AngularJS controllers:

1) Use AngularJS $rootScope without creating Service

2) Use depending parent and child relation between controller scopes.

3) Use AS keyword (If you are using angularJS 2.0, then you can use the “As” keyword which will pass your data from one controller to another controller)

Use AngularJS $rootScope without creating Service

AngularJS $rootScope is another option to share data between two controllers. This is also a way to share data across Controllers, to read or modify a global property.

See bellow example:

HTML Code:

Use Depending Parent And Child Relation

As the name suggest this mechanism works with two controllers.

See bellow example:

HTML Code:

Tags: , , ,

About: Prem Tiwari

Prem Tiwari is the founder of and is a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby.

You may also like:

Get Free Access of 450+ Scripts

Don't worry you'll not be spammed!

Featured eBook

WordPress Security Guide

Free Guide: Learn how to implement security guideline in your WordPress site...


Free WordPress Setup Service

Free WordPress Setup

Want to Setup WordPress Blog Setup? I will help you in the setup of your WordPress blog.

Click Here

Pincode Finder

pincode-finder tool

Online Pincode Finder

Best tool to locate post Office address and pincodes of all india...