Coder Social home page Coder Social logo

Comments (11)

poindexd avatar poindexd commented on April 25, 2024

+1

from sticky-states.

soroushNeshat avatar soroushNeshat commented on April 25, 2024

of course it wont change unless u exit the parent state . a sticky state is sticky . it cant be removed until parent is exited . problem is that you are sharing ui-view='view1' for both of the sticky states . u have to create a ui-view for each widget in your parent state like this :

ui-view='widget1'
ui-view='widget2'
ui-view='widget3'

from sticky-states.

buksy90 avatar buksy90 commented on April 25, 2024

Unfortunately that is not possible in current project :/.

From my point of view, the ideal workflow for sticky states would be something like this (pseudo):

state_entered() {
  #create scope
  if(cache[state.name]) scope = cache[state.name].scope
  else scope = $rootScope.new();

  #create controller
  if(cache[state.name]) controller = cache[state.name].controller
  else scope = $controller(state.controller, ctrlOptions);

  #compile 
  link = $compile(element);

  return link(scope);
}

I tried to create a ui-router plugin for this with a little ui-router modification. I modified ui-router to use own service for creating scope and controller. Here is the diff .
Here is jsbin playground with changed ui-router and plugin implementation. Unfortunately it doesnt work. It does display each state first time. When state is entered again, scope and controller are returned from cache, but the template doesnt get compiled and Im not sure why :(.

I thought this might be alternative to sticky-states but not sure how to fix this. I think the problem is with scope not being handled properly by ui-router. I tried to suppress $destroy event but it doesnt work anyway. :(

from sticky-states.

nandakumar531 avatar nandakumar531 commented on April 25, 2024

Hello @christopherthielen ,

we are also getting the same issue where @buksy90 got.

using ng1 (1.6.1) + [email protected]+ uirouter/[email protected] + uirouter/[email protected] + uirouter/[email protected]

In different scenarios, the stickiness is failing.

  1. Same as @buksy90 mentioned.
  2. Here is another example
    three tabs used in the above example. home, about and deepnest. The deepnest tab is decorated with sticky: true . Between home and about tabs the state transition is working fine because there is no stickiness is applied. But when user clicks the deepnest tab and come back to home or about tabs, transitions returns "success" but deepnest view is showing. The about or home view is not updating.

With ui-router-extras the sticky state functionality working fine. But when we upgrade it to latest uirouter/[email protected] then we are facing the above issues. Even I checked with all the ui-router latest versions the same issue persists.

Are these issues addressed in coming versions?

from sticky-states.

nandakumar531 avatar nandakumar531 commented on April 25, 2024

@buksy90 is this issue resolved to you?

from sticky-states.

buksy90 avatar buksy90 commented on April 25, 2024

Hello @nandakumar531, no I havent found any solution yet.

@christopherthielen could you please share any info on whether this functionality has been ever considered? If so, what is the reasons it hasn't been implemented?

from sticky-states.

SadhanaNukala avatar SadhanaNukala commented on April 25, 2024

@christopherthielen Can you please let us know when this issue will be fixed.
attaching the above example which @buksy90 mentioned again for reference : http://jsbin.com/lohasefoza/5/edit?js,output

from sticky-states.

xDisfigure avatar xDisfigure commented on April 25, 2024

I'm not sure but check this out : DeepStateRedirect in ui-router extra plugins maybe that will solve your problem

from sticky-states.

 avatar commented on April 25, 2024

My issue is quite similar.

We have sticky on moduleA.home, from there url to moduleA.something won't navigate. The controller of something is not even fired. Note that moduleA is just an abstract state.

  • deepStateRedirect = true won't help.
  • remove sticky make things work smoothly.

p/s : guys , have u found any solutions

from sticky-states.

joniruokamo avatar joniruokamo commented on April 25, 2024

This is bugging me as well. Any solution in sight?

from sticky-states.

christopherthielen avatar christopherthielen commented on April 25, 2024

This behavior is working as designed and isn't going to change. As mentioned by @soroushNeshat in #24 (comment) and in the documentation,

The sticky state's view must have its own unique ui-view (not shared by other states). Create and target a named ui-view.

This limitation is by design and can't be changed. Proposed work arounds such as trying to save and restore components manually would be prone to many edge cases and is not something I'm willing to support. Further, those solutions would only work for one framework (i.e., AngularJS) where as the sticky states approach works for all frameworks (i.e., React, Angular, AngularJS)

So, the answer to this issue is: use named ui-view and target the named ui-view in the sticky state. Show and hide the ui-view when the state is active/inactive.

from sticky-states.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.