简体   繁体   English

AngularJS烤面包机关闭按钮不可见

[英]AngularJS toaster close button not visible

I am using AngularJS Toaster in my application for getting dynamic notifications.Present I am getting the notifications but close button is not visible. 我在我的应用程序中使用AngularJS Toaster获取动态通知。目前我正在获取通知,但关闭按钮不可见。 This is my code 这是我的代码

 var message = "Welcome..";
        $scope.popToaster = function(){
            toaster.pop('success', "Alert", message);
}

HTML : HTML:

 <toaster-container toaster-options="{'close-button': true}"></toaster-container>

Please suggest if I am doing anything wrong? 请建议我是否做错了什么?

As you mentioned that you are using version 0.3 of AngularJS-Toaster I suggest to use the latest version or at least 0.4.7. 正如您提到的那样,您正在使用AngularJS-Toaster的0.3版本,我建议使用最新版本或至少0.4.7。 The close button was added above 0.4.6 as you can see here in the directive template. 您可以在指令模板中看到在0.4.6上方添加了关闭按钮。 Another advantage is that you can use functions like success or error on the toaster service itself. 另一个优点是您可以在toaster服务本身上使用successerror类的功能。 Here is a small example: 这是一个小例子:

<div ng-app="myApp">
    <toaster-container toaster-options="{'close-button':true}"></toaster-container>
    <div class="container" ng-controller="myCtrl">
        <button type="button" ng-click="displayToaster()">Toaster</button>
    </div>
</div>

And here is the script file: 这是脚本文件:

var myApp = angular.module("myApp", ["toaster"]);

myApp.controller("myCtrl", function ($scope, $http, toaster) {
    $scope.displayToaster = function () {
        toaster.success("Welcome...");
    };
});

So please use the latest version 0.4.13 from the official git repository . 因此,请使用官方git仓库中的最新版本0.4.13。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM