toastr

Unable to import toastr module with Angular 2

时光怂恿深爱的人放手 提交于 2019-12-19 09:48:05
问题 I am creating an Angular 2 application with version 2.0.0-alpha.46 and I trying to import the toastr module. I have downloaded the library and also downloaded the definitely typed file as well. In my html page, I add a <script> tag for the .js file: <script src="./src/libs/toastr/toastr.min.js"></script> In Visual Studio Code, I try to import the module like so: import * as toastr from 'toastr'; I am then able to call toastr.info('message') in my component - I even get intellisense; However,

binding an event in offline.js

拟墨画扇 提交于 2019-12-13 18:27:39
问题 I'm trying to get offline.js working together with toastr alerts. My limited JS knowledge is holding me back but hoping some can shed some light on this. What I want to happen When the connection goes from down to up, I want to display a "re-connected successfully" message in a toast alert. The Problem I don't understand how to check for that status in offline.js. The docs mention that it's possible using this: Offline.on(event, handler, context) : Bind an event. Events: up: The connection

How can toastr.js work in Aurelia and Typescript?

无人久伴 提交于 2019-12-12 09:38:20
问题 I can't seem to get these to work together. I'm using the Aurelia CLI and have done so in a similar manner for other libraries successfully(like select2, spin, moment and numeral). I can't seem to get toastr to work though. Here is what I have so far. First I ran npm install toastr --save and typings install dt~toastr --global --save In aurelia.json , in the vendor-bundle.js section, I added a dependency as such: "jquery", { "name": "toastr", "path": "../node_modules/toastr/build", "main":

Adding toastr javascript asp.net webform

£可爱£侵袭症+ 提交于 2019-12-12 08:23:24
问题 I am trying to display a toastr message (info,error etc) after submitting a form using a button and update a gridview control (which is in a update panel" in asp.net webform. Thanks 回答1: You can do it using Page.ClientScript.RegisterStartupScript method. Example: Page.ClientScript.RegisterStartupScript(this.GetType(), "toastr_message", "toastr.error('There was an error', 'Error')", true); But I would probably create a method or extension method to handle that for me: public static void

How to easily switch off Toastr JS

守給你的承諾、 提交于 2019-12-12 06:30:12
问题 What is the easiest way to switch on and off Toastr JS ? I did not find a solution in the docs. My project is an angulat one, I am using Toastr for my dev environnement and want toasts to stop displaying when building. 回答1: No need to add a CSS rule-set. You can just use the target option: // turn off toastr.options.target = null // turn on toastr.options.target = 'body' 回答2: Easiest answer is via css of course. #toast-container { display:none; } 来源: https://stackoverflow.com/questions

Using timeouts with toastr

99封情书 提交于 2019-12-12 03:05:13
问题 Most of the toastr demos are client side only. If I get a server push of this json data [ {"msg": "Mortgage bill paid", "t": "i"} {"msg": "Account Balance below $3000", "t": "i"} {"msg": "Received Car payment request", "t": "w"} ] How would I use toastr read through items and publish 'info' for 1 and 2, "warning" for 3, lower right is ok. I would like a delay of 2000 between toasts so the toast dont come at the same time. Can you point me to example that show something similar. Can toastr do

Angular 2 : Loading nested Component is destroying the existing scope of ng2-toastr

江枫思渺然 提交于 2019-12-12 02:16:37
问题 I'm using a ng2-toastr in my page and working fine, but when I have a nested component in the page the existing ng2-toastr(ToastManager) scope is destroyed and toastr is not working. constructor(public toastr: ToastsManager,public vcr: ViewContainerRef) { this.toastr.setRootViewContainerRef(vcr); } In My method when I call this.toastr.warning('Its Warning','Alert'); Its Working fine, but in my html when I'm loading other component i.e <es-app></es-app> the toastr in my page is not working (No

set toastr.js options for each toast type individually

a 夏天 提交于 2019-12-11 07:14:35
问题 Is it possible to set toastr options for each toast type individually? My toastr code toastr.options = { "closeButton": true, "debug": false, "newestOnTop": false, "progressBar": false, "positionClass": "toast-bottom-right", "preventDuplicates": false, "onclick": null, "showDuration": "300", "hideDuration": "1000", "timeOut": "60000", "extendedTimeOut": "60000", "showEasing": "swing", "hideEasing": "linear", "showMethod": "fadeIn", "hideMethod": "fadeOut" }; const infoMessage = $(".js-toast

Jquery toastr onHidden function

我与影子孤独终老i 提交于 2019-12-11 04:50:06
问题 I am using jquery toastr. So far everything is great. I can display and close toasts fine. I want to be able to identify each toast uniquely. And use that unique identifier in the onHidden function. Has anyone done this before? Is the better option to call a jquery on close event for the toastr class or div surrounding the closed toast? var mes = 'My name is Inigo Montoya.<input type="hidden" id="announcementId" value="1"/>' + '<input type="hidden" id="userId" value="'+ userid +'"/> '; var

toastr undefined with requirejs

我的梦境 提交于 2019-12-11 03:19:19
问题 I am loading toastr.js with require.js in to my angular project however it is not available as global variable. This is main.js: require.config({ baseUrl: 'js', paths: { domReady: '../lib/requirejs-domready/domReady', jquery: '../lib/jquery/jquery', jqueryValidate: '../lib/jquery.validation/jquery.validate', underscore: '../lib/underscore/underscore', bootstrap: '../lib/bootstrap/dist/js/bootstrap', moment: '../lib/momentjs/moment', toastr: '../lib/toastr/toastr', angular: '../lib/angular