Updating URL in Angular JS without re-rendering view

前端 未结 9 1874
情书的邮戳
情书的邮戳 2020-12-04 08:33

I\'m building a dashboard system in AngularJS and I\'m running into an issue with setting the url via $location.path

In our dashboard, we have a bunch o

9条回答
  •  抹茶落季
    2020-12-04 08:56

    If I understood your question right, you want to,

    1. Maximize the widget when the user is on /dashboard/:dashboardId and he maximizes the widget.
    2. You want the user to have the ability to come back to /dashboard/:dashboardId/:maximizedWidgetId and still see the widget maximized.

    You can configure only the first route in the routerConfig and use RouteParams to identify if the maximized widget is passed in the params in the controller of this configured route and maximize the one passed as the param. If the user is maximizing it the first time, share the url to this maximized view with the maximizedWidgetId on the UI.

    As long as you use $location(which is just a wrapper over native location object) to update the path it will refresh the view.

提交回复
热议问题