I am trying to pass the data from one html to another html page after clicking on particular table row but unable to send the data.
Asked
Active
Viewed 1,456 times
0
-
share some code – M14 Nov 25 '16 at 06:58
-
2can u show us some code which u had tried .... so that we can help u other wise we can provide reference links only – Sa E Chowdary Nov 25 '16 at 06:58
3 Answers
1
You can share data between two controllers by
- $rootScope - assign a value and use the same in other controller
- Via URL Parameter : specify param in config and use $stateParams or $routeParams
- Service or Factory
Ref :
URL Parameter example : pass data between controllers
Service or Factory : https://thinkster.io/a-better-way-to-learn-angularjs/services,
Service or Factory : https://egghead.io/lessons/angularjs-sharing-data-between-controllers

Community
- 1
- 1

Sudhindra_Chausalkar
- 163
- 1
- 5
-
I have tried using factory. I am able to set the values but then when another page navigates values get reset again. Unable to return the values which have been set – RasikaP Nov 25 '16 at 10:27
0
You can call set function of factory to store data in object from controller.
then after opening second html, call get function of factory which will return stored object to you. In this way you can pass data to any html page.
Hope this will helpful to you.

Avinash Rathod
- 590
- 4
- 15
-
I have tried using factory. I am able to set the values but then when another page navigates values get reset again. Unable to return the values which have been set – RasikaP Nov 25 '16 at 11:25
0
You can use $rootScope to set data globally which will be applicable for all the pages inside an angularjs application.
var app = angular.module('app',[]).run(function($rootScope){ $rootScope.userName = "xyz"; });
You can also pass data in URL of the page

Arun Kasyakar
- 905
- 8
- 9