0

I am having a redirection issue while using angular ionic framework. I have a list page displaying list of records, which has a add button. When user clicks on it, it takes to the add record screen, after user is done with adding record, i am trying to redirect it to the list page so that user can see newly added record.

Here is the code i am using for redirection. This does not work. It shows the correct url on the browser window, flips the view correctly but does not retrieve the newly inserted record. I tried to place a break point in my controller but my break point is not even being hit, while redirection.

$state.go('customer.detail', { 'id': key});

I also tried this but same result. It does not work either. $location.path("/detail/"+key);

Cœur
  • 37,241
  • 25
  • 195
  • 267
ATHER
  • 3,254
  • 5
  • 40
  • 63
  • Why are you using 'customer.detail'. What's your page url to which you wants to redirect? Is it customer or detail? – Reena Apr 08 '15 at 05:30
  • its the detail page. And syntax for $state.go is correct since i am not hard coding my urls in my controllers.It is alias defined in angular routing – ATHER Apr 08 '15 at 14:53

1 Answers1

1

ok finally i was able to fix this issue by adding a property to my state as cache:false.

            .state('customer.detail', {
            url: '/detail/:cid',
            cache:false,
            views: {
                'tab-search': {
                    templateUrl: 'app/Customer/CustomerDetail.html'
                }
            }
        })

Got the tip here.

Reloading current state - refresh data

Community
  • 1
  • 1
ATHER
  • 3,254
  • 5
  • 40
  • 63