Angular
Toastr in AngularJs projects
Gravatar is a globally recognized avatar based on your email address. Toastr in AngularJs projects
  Harvey Mushman
  All
  Feb 18, 2019 @ 12:23pm

What is the simplest way to install toastr to AngularJS (1.x) ?

There are old versions like Angular-Toastr but they are no longer maintained since 2015.

What is the syntax you used to install the native verison of Toastr... App.js module and what about controllers, does it need to be injected too?

Thanks for any suggestions...

Gravatar is a globally recognized avatar based on your email address. re: Toastr in AngularJs projects
  Rick Strahl
  Harvey Mushman
  Feb 18, 2019 @ 01:29pm

I just use the raw toastr.js - there's little need to an angular wrapper because those functions are static and don't really sit on a page directly - you're usually firing toastr in response to some action anyway and you're not binding values to it.

So just add toastr.js in to your index page (or whereever you are loading scripts).

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Toastr in AngularJs projects
  Harvey Mushman
  Rick Strahl
  Feb 18, 2019 @ 02:22pm

thanks for confirming...

my problem was a typo, lol you are not the only one that makes those...

In my index.html file I spelled <script scr="... and it should have read "src"=

Two (wasted) hours of reading online documents and it now works!

Gravatar is a globally recognized avatar based on your email address. re: Toastr in AngularJs projects
  Harvey Mushman
  Rick Strahl
  Mar 13, 2019 @ 01:03pm

First... posted a message here this morning using computer #1 required email and password. logged in with save values as always. Checked remember me. Now working on computer #2 which is where I logged in a week ago. Again asked me for email and password and I check again remember me. Don't understand why it does not remember me?

Real question...

I'm using Toastr for confirm popups. Working great.

I'm wondering with the raw version of Toastr (not the Angular-Toastr varsion) have you been able to get angular scope to be exposed inside the Toastr message body?

Something like this:

toastr.warning("<button ng-click='oAccept()'>accept</button> or <button ng-click='oDeny()'>Deny</button>")

// my controller
this.oAccept = function(){ some code }
this.oDeny = function(){ other code }

Gravatar is a globally recognized avatar based on your email address. re: Toastr in AngularJs projects
  Rick Strahl
  Harvey Mushman
  Mar 13, 2019 @ 01:30pm

You should be able to access $scope as needed.

Honestly I haven't touched AngularJs in so many years I don't remember how the old Scope logic works.

Login - I've changed the login handling recently. The timeout now should be 30 days. It still timed out because you probably had an earlier shorter login.

+++ Rick ---

© 1996-2024