我在我的应用程序中使用AngularJS Toaster来获取动态通知。现在我收到通知但是关闭按钮不可见。这是我的代码
var message = "Welcome..";
$scope.popToaster = function(){
toaster.pop('success', "Alert", message);
}
HTML:
<toaster-container toaster-options="{'close-button': true}"></toaster-container>
请告知我做错了什么?
答案 0 :(得分:1)
正如您所提到的,您使用的是AngularJS-Toaster 0.3版本,我建议使用最新版本或至少0.4.7。关闭按钮添加到0.4.6以上,因为您可以在指令模板中看到here。另一个优点是您可以在success
服务本身上使用error
或toaster
等功能。这是一个小例子:
<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>
这是脚本文件:
var myApp = angular.module("myApp", ["toaster"]);
myApp.controller("myCtrl", function ($scope, $http, toaster) {
$scope.displayToaster = function () {
toaster.success("Welcome...");
};
});
请使用官方git repository中的最新版本0.4.13。