Passing object between views (flash message)

前端 未结 3 1631
春和景丽
春和景丽 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:08

    I was looking to implement similar functionality, but actually wanted more of a growl style message.

    I've updated the excellent plinkr code that Andy provided above to include a 'pop' method that leverages the toastr growl-style notification library.

    My update also lets you to specify the notification type (info, warning, success, error) and title.

    The 'pop' method skips adding the message to the queue, and instead pops it up on the screen immediately. The set/get functionality from Andy's previous plinkr remains mostly unchanged.

    You can find my update here: http://plnkr.co/edit/MY2SXG?p=preview

提交回复
热议问题