AngularJS - add ngToast configuration to *.routes.js

262 Views Asked by At

I have this configuration in my angularJS application

(function() {
'use strict';

angular
    .module('myAppl.dashboard')
    .config(configure);

configure.$inject = ['$stateProvider']; 

function configure($stateProvider) {

    $stateProvider
        .state(getDashboardState());

    ////////////

    function getDashboardState() {
        var state = {
    ...

Now I will use ngToast with this config:

angular
  .module('myModule')
  .config(['ngToastProvider', function(ngToast) {
    ngToast.configure({
      verticalPosition: 'bottom',
      horizontalPosition: 'center',
      maxNumber: 3
    });
  }]);

I thought that I can inject ngToast like this:

configure.$inject = ['$stateProvider', 'ngToast']; 

function configure($stateProvider, ngToast) {

    ngToast.configure({
      verticalPosition: 'bottom',
      horizontalPosition: 'center',
      maxNumber: 3
    });

but this lead in a Uncaught Error: [$injector:modulerr] error

0

There are 0 best solutions below