AngularJS: Change hash and route without completely reloading controller

前端 未结 10 1231
鱼传尺愫
鱼传尺愫 2020-12-07 19:29

I have a controller, with a route like this:

#/articles/1234

I want to change the route without completely reloading the controller, so I can keep the positi

10条回答
  •  隐瞒了意图╮
    2020-12-07 20:05

    Use:

    $routeProvider.when('/somewhere', {
        controller: 'SomeCtrl',
        reloadOnSearch: false
    })
    

    This will prevent reloading the controller on query parameter change, but also on hash change.

提交回复
热议问题