I have been using angularjs for developing web applications. I want to add the data filled in chatCtrl(controller) in chat.html to another controller (chatScrnCtrl) in chatScrn.html, i.r both the html are different through ng-view. I hope you get what im saying, im designing a web messenger application and i need to add the chat to the chatscreen once i type in the chatlist. I also need to display these in the chat history page. Hope u guys understand what i need. so pls provide a way for this rather than providing me the solution to access controllers in the same html file or the same js file.
Asked
Active
Viewed 63 times
-5
-
Possible duplicate of [Share data between AngularJS controllers](https://stackoverflow.com/questions/21919962/share-data-between-angularjs-controllers) – Manikandan Velayutham May 26 '17 at 06:51
-
pls read my edited question and give a solution. – santosh May 26 '17 at 12:28
-
the solution u gave is just for the input data to be displayed in another text using ng-model and controller. i know the basics and im not that dumb to ask such a question – santosh May 26 '17 at 12:30
-
Use custom service.. – Manikandan Velayutham May 26 '17 at 13:06
2 Answers
1
try to utilize services provided by angularjs, use $broadcast to tranfer data between controllers

md-5h04I3
- 214
- 2
- 12
0
You can write a angular service with Getters()
and Setters()
method and inject them in your controller.

Rohan Kawade
- 453
- 5
- 18