I am facing some problem with ui-router in angularjs. I am trying to pass data from one state to another.
Data:
$scope.MyData = [
{
"name": "Alice",
"age": "20",
"email": "example@example.com"
},
{
"name": "Bob",
"age": "20",
"email": "example1@example.com"
}
];
View:
<div ng-repeat="data in MyData" >
<div>
<span>Name: {{data.name}}</span>
<span>Age: {{data.age}}</span>
</div>
</div>
When user clicks on this div, I want to display email data for clicked contact in contact.details state view.
Controller:
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('contact.list', {
url: '/contacts',
templateUrl: 'templates/contact-list.html',
controller: 'contactCtrl'
})
.state('contact.details', {
url: '/contactdetails',
templateUrl: 'templates/contact-details.html',
controller: 'contactCtrl'
})