我怎么能用角度来动态我的flash消息。消息必须通过API响应

问题描述 投票:0回答:1

我的flash消息代码如下

<div class="flash-message" ng-if="flash">
<div class="{{'alert alert-' + flash.type}}" ng-bind="flash.message"> 
</div>

现在我正在使用

  FlashService.Success('You have blocked this User');

我想让我的上述消息动态,我现在已经通过了静态。

我的节点api现在返回此消息

{
"data": {
    "status": "1",
    "msg": "You have blocked the user"
}
}
angularjs node.js npm angularjs-directive angular-ui-router
1个回答
5
投票

将结果传递给函数回调。

{
"data": {
"status": "1",
"msg": "You have blocked the user"
}
}

下面的代码使flash消息动态化。

   FlashService.Success(result.data.msg);
© www.soinside.com 2019 - 2024. All rights reserved.