RAHUL RAHUL - 1 year ago 63
AngularJS Question

Sending data from one controller to another

I think this is a very simple problem but i'm not able to figure it out.

I have 2 controllers in my angularjs file..

$scope.builds = [];
function(data) {
$scope.builds = data.responseData;



$scope.cases = [];
function(data) {
$scope.cases = data.responseData;


I want to send the value of item in the first controller to the 2nd controller . Item is the value user selects from a box of html page.

Answer Source

Set state like this


.state('page1', {
    url: '/page1/:id/:name'

in Your Controller inject $stateParams

then you can get data like