【问题标题】:Placing a pop out message once function has finished功能完成后放置弹出消息
【发布时间】:2016-05-16 14:48:55
【问题描述】:

在这种情况下(smsAll)函数完成运行后,如何放置弹出消息,例如“消息发送成功”?

控制器

    $scope.smsAll = function() {

        $scope.smsStatusZeroF2F = "";
        $scope.smsStatusMoreThanTenF2F = "";
        $scope.smsStatusBetween14F2F = "";

        if ($scope.isSMSzeroF2F) {
            $scope.smsZeroF2F();
        }

        if ($scope.isSMSmoreThanTenF2F) {
            $scope.smsMoreThanTenF2F();
        }

        if ($scope.isSMSBet14F2F) {
            $scope.smsBetween14F2F();
        }

        if ($scope.isSMSZeroPSL) {
            $scope.smsZeroPSL();
        }

        if ($scope.isSMStransAndsaas) {
            $scope.smsZeroTransOrSaasReport();
        }

    };

report.html

   <button type="button" class="btn btn-primary" ng-click="smsAll()">Send SMS for selected</button>

【问题讨论】:

标签: angularjs node.js strongloop


【解决方案1】:

为什么不使用一些角度通知模块? 就像this 源代码为here

或使用 Bower 安装

bower install angular-notify --save 

将 dist/angular-notify.js 和 dist/angular-notify.css 添加到您的 index.html。

将 cgNotify 添加为您的模块的模块依赖项。

angular.module('your_app', ['cgNotify']);

用法:

function myController($scope,notify){  // <-- Inject notify

  notify('Your notification message'); // <-- Call notify with your message

  notify({ message:'My message', templateUrl:'my_template.html'} );

}

【讨论】: