Angular ui-router nested views don't refresh data retrieved by Angular Services

前端 未结 2 1143
忘掉有多难
忘掉有多难 2021-01-24 13:03

I have a nontrivial Angular SPA that uses ui-router to manage multiple views, many of which are visible at the same time. I need models to be visible across controllers, so I ha

相关标签:
2条回答
  • 2021-01-24 13:51

    This is no problem of ui.router. If you intend for your model (your data service) to be a single source of truth, you have to refrain from destroying it.. err.. the reference to it that is. And in your case, assigning a primitve (a string) directly to the scope, instead of a reference to it. In other words...

    var password = {pw:'initial value'};
    

    and then later setting/binding only on

    password.pw = newpassword
    
    {{password.pw}}
    

    Heres a fiddle. And also here is a short little read on scopes, It also includes a video of an angular meetup where Misko talks about "always have(ing) a dot in your model" link and how the $scope is a place to expose your model, not be your model. (aka not a place to assign primitives like password = 'initial value')

    Hope this helps!

    0 讨论(0)
  • 2021-01-24 13:55

    try remove the animation property of your ion nav view. remove the property animation="slide-left-right"

    it would be ok.

    0 讨论(0)
提交回复
热议问题