Persisting query string with AngularJS routing

前端 未结 6 2174
盖世英雄少女心
盖世英雄少女心 2021-01-05 18:11

I\'ve been working on a large Angular app for almost a year now and I\'m stuck trying to do what I expected to be trivial.

Here are two routes I have with params (sh

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-05 18:21

    if route is /#/a/1?foo=123&bar=456 then redirect to /#/a/1/b?foo=123&bar=456

    I have worked on /#a?foo=bar to /#b?foo=bar, it can be easily tweaked to /#a/b?foo=bar and used angular-route-segment library.

    Run the plunker at http://run.plnkr.co/HvSyw4aMUiy1mwC3/#/firstRoute?foo=bar

    and see the code here

    http://plnkr.co/edit/ylFM8BHRXpqpMV7QVEcJ

    Please let me know if it works.

提交回复
热议问题