Passing object between views (flash message)

前端 未结 3 1638
春和景丽
春和景丽 2021-02-07 12:51

What is the best way to pass message in the below scenario.

In the success scenario of $scope.p.$save, the result contains a message (res.message

3条回答
  •  春和景丽
    2021-02-07 13:00

    You could use a service which displays the flash on $routeChangeSuccess.

    Each time you set a flash message, add it to a queue, and when the route changes take the first item off the queue and set it to the current message.

    Here's a demo:

    http://plnkr.co/edit/3n8m1X?p=preview

提交回复
热议问题