I have an ng-repeat on a directive where I'm passing in 3 pieces of information. The directive has a button where I pass that information on to another view using params as such:
ui-sref='profiles.show({userId:profile._id, index:index, list:list})
The problem I have is that the buttons for all of the cards (the cards are the directives) worked properly, except for the one at index 0. The button won't perform a ui-sref or a $state.go. I tried having it with an ng-click and console logging all the params and the console log works displaying the correct data, but the $state.go with the params is not triggering.
$state.go('profiles.show', {userId: profile._id, index: index, list: list})
Also, if I remove the index and the list from the params, the ui-sref or $state.go for the first element works again, but in the next view I don't get the necessary information anymore.
Here is the state config for profiles.show
.state('profiles.show', {url: '/{userId}', params: { index: null, list: null }, templateUrl:'/views/profiles/show/show.html', controller: 'ProfilesShowController'})
And here is the ng-repeat (I'm using Jade):
.text-capitalize(al-card, ng-repeat='profile in profiles | filter:searchBar track by $index', profile='profile', index='$index', list='profiles')
This is the button with the ng-click
button.btn.btn-default(ng-click='goToProfile(profile, index, list)') Learn More
And the $scope function:
$scope.goToProfile = function(profile, index, list) {
console.log(profile);
console.log(index);
console.log(list);
$state.go('profiles.show', {userId: profile._id, index: index, list: list});
};
Any help with this?