【问题标题】:How i can dynamic my flash message in angular. message must be coming through API response我如何以角度动态化我的 Flash 消息。消息必须来自 API 响应
【发布时间】:2018-10-24 22:35:11
【问题描述】:

我的闪信代码如下

<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】:

    在函数回调中传递结果。

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

    将下面的代码添加到动态消息中。

       FlashService.Success(result.data.msg);
    

    【讨论】:

    • 感谢它拯救了我的一天。
    • 并使用 ng-class 代替 class
    猜你喜欢
    • 1970-01-01
    • 2022-12-06
    • 2019-02-20
    • 1970-01-01
    • 2019-03-26
    • 2020-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多