The way you tell angular-toastr to not show duplicate is by setting preventDuplicates to true inside the toastrConfig object. And not in the toastr.error or success or any opener for that matter.
So, your code would look something like this:
app.controller('MainCtrl', function($scope, toastr, toastrConfig) {
toastrConfig.preventDuplicates = true;
toastrConfig.preventOpenDuplicates = true;
toastrConfig.progressBar = true;
toastrConfig.closeButton = true;
$scope.OpenToastr = function() {
toastr.error('test', 'open duplicate');
}
});
EDIT: Found it! It's the version! :)
According to angular-toastr > CHANGELOG,
Version 1.4.0
- With
preventOpenDuplicates you can prevent duplicates of opened toasts.
The functionality got introduced in 1.4.0 and you were using 1.3.1.
working plunker (updated)