christopherthielen / ui-router-extras

THIS PROJECT IS NO LONGER MAINTAINED -- Extras for UI-Router for AngularJS. Sticky States (a.k.a. parallel states), Deep State Redirect (for tab-like navigation), Future States (async state definition)
http://christopherthielen.github.io/ui-router-extras/
MIT License
917 stars 211 forks source link

Sticky state not working #275

Open napcat opened 8 years ago

napcat commented 8 years ago

Hello,

I'm using angular 1.4.8, ui-router 0.2.15 and ui router extras 0.1.0.

I have the following states the navigation is correct, but and I'am not able to get sticky working.

.state("civil",
{
    url: "/civil",
    templateUrl: "civil/CivilView.html",
    data: {  topbarTitle: "CIVIL" }
})

.state("civil.alerts",
{
    url: "/alerts",
    sticky: true,
    views:
    {
        alerts:
        {
            templateUrl: "civil/alerts/CivilAlertsView.html",
        }
    },
    data: { topbarTitle: 'CIVIL' }
})

.state("civil.details",
{
    url: "/details",
    views:
    {
        details:
        {
            templateUrl: "civil/details/CivilDetailsView.html",
        }
    },
    data: { topbarTitle: 'CIVIL_DETAILS', hideBackButton: false }
})

And this is my main view:

<div class="app-content">
    <div ui-view="alerts" ng-show="CivilProtectionVM.CheckState('civil.alerts')" />

    <div ui-view="details" ng-show="CivilProtectionVM.CheckState('civil.details')" />
</div>

Also when I active debuging, an error appears on the console:

TypeError: Cannot read property 'self' of undefined
at debugViewsAfterSuccess (ct-ui-router-extras.js:1251)
at transitionSuccess (ct-ui-router-extras.js:1197)
at processQueue (angular.js:14792)
at angular.js:14808
at Scope.undefined.$get.Scope.$eval (angular.js:16052)
at Scope.undefined.$get.Scope.$digest (angular.js:15870)
at Scope.undefined.$get.Scope.$apply (angular.js:16160)
at angular.js:17927
at completeOutstandingRequest (angular.js:5552)
at angular.js:5829

So I want to go "civil.alerts". On that view a select an item from a list and go to the "civil.details". On "civil.details" I can go back to "civil.alerts". When that happens I want to maintain the scroll position, the selection, etc, basically the DOM and the controller. But that is not happening. The controller is called again and the state not maintained.

Am I missing some adicional config, besides the "sticky:true" on the "civil.alerts" state?

Can someone help on this issue?