title: Unknown provider: toasterProvider <- toaster <- RugHttpInterceptor <- $http <- ng1UIRouter
body: <p>I am working on Interceptors to display a toast msg if my app caught a http error in responseError code.
  I am using <strong>AngularJS Interceptor</strong>. It is an MEAN.JS app.</p>
  
  <p><strong>Interceptor Code</strong></p>
  
  <pre><code>angular.module('rugCoPro')
  
  .factory('RugHttpInterceptor', ['$q', 'Session', '$state', 'toaster',
  function($q, session, $state, toaster) {
  
      return {        
          'request': function(config) {
              console.log("inside the request."); 
              return config;
          },       
  
          // Optional method        
          'response': function(response) {
              // do something on response success
              console.log('inside of response');
  
              return response;
          },
  
          // optional method 
          'responseError': function(rejection) {
              // Here you can do something in response error, like handle errors, present error messages etc.
              if(rejection.status === 401){
                  console.log( "inside the response error : "+ rejection.status);
                  $state.go('auth');
              }
  
              // console.log("inside the response error " + rejection.status);
              return $q.reject(rejection);
          }
      };
  }]);
  </code></pre>
  
  <p><strong>error:</strong>
  <a href="https://i.stack.imgur.com/AMh8k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AMh8k.png" alt="Error updated pic"></a></p>
  
  <p>I am trying to find out the solution but stuck from hours...</p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>angular.module('rugCoPro', [
      'ngMaterial',
      'ngMdIcons',
      'ui.router',
      'e3-core-ui.services', 
      'e3-core-ui.utils'  
  ])
  
  .config(['$stateProvider', '$routeProvider','$httpProvider','$mdThemingProvider', '$mdIconProvider', function($stateProvider, $routeProvider, $httpProvider, $mdThemingProvider, $mdIconProvider) { 
  
          //rug interceptor code
      $httpProvider.interceptors.push('RugHttpInterceptor');
  ...
  }
  </code></pre>
  
  <p><strong>Scripts and css</strong>
  using npm install and add in gruntfile.js</p>
  
  <blockquote>
    <p>"node_modules/angularjs-toaster/toaster.css",<br>
    "node_modules/angularjs-toaster/toaster.js",</p>
  </blockquote>
  
  <p><strong>Gruntfile.js</strong></p>
  
  <pre><code>module.exports = function(grunt) {
  
    grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
  
      concat: {
        options: {
          separator: ';'
        },
        dist: {
          src: ['front-end/src/*.js', 'front-end/src/controllers/**/*.js', 'front-end/src/services/**/*.js'],
          dest: 'public/js/&lt;%= pkg.name %&gt;.min.js'
        },
        lib:{
          src: [
            "node_modules/angular/angular.min.js",
            "node_modules/angular-route/angular-route.min.js",
            "node_modules/angular-aria/angular-aria.min.js",
            "node_modules/angular-animate/angular-animate.min.js",
            "node_modules/angular-material/angular-material.min.js",
            "node_modules/moment/moment.min.js",
            "front-end/lib/e3-core-ui.js",
            **// angularjs -toaster
            "node_modules/angularjs-toaster/toaster.min.js",**
            "node_modules/angular-material-icons/angular-material-icons.min.js",
            "node_modules/angular-ui-router/release/angular-ui-router.min.js"
          ],
          dest: 'public/js/libs.min.js'
        },
        lib_debug:{
          src: [
            "node_modules/angular/angular.js",
            "node_modules/angular-route/angular-route.js",
            "node_modules/angular-aria/angular-aria.js",
            "node_modules/angular-animate/angular-animate.js",
            "node_modules/angular-material/angular-material.js",
            "node_modules/moment/moment.js",
            "front-end/lib/e3-core-ui.js",
            **// angularjs -toaster
            "node_modules/angularjs-toaster/toaster.js",**
            "node_modules/angular-material-icons/angular-material-icons.js",
            "node_modules/angular-ui-router/release/angular-ui-router.js"
          ],
          dest: 'public/js/libs.js'
        },
        css:{
          src:[
            "node_modules/angular-material/angular-material.css",
            "front-end/lib/e3-core-style.min.css",
            "front-end/style/app.css",
            **// angularjs -toaster
            "node_modules/angularjs-toaster/toaster.css",**
          ],
          dest:'public/css/lib.css'
        }
      },
      uglify: {
        options: {
          banner: '/*! &lt;%= pkg.name %&gt; &lt;%= grunt.template.today("dd-mm-yyyy") %&gt; */\n'
        },
        dist: {
          files: {
            'public/js/&lt;%= pkg.name %&gt;.min.js': ['&lt;%= concat.dist.dest %&gt;']
          }
        }
      },
    });
  
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-jasmine');
    grunt.loadNpmTasks('grunt-jasmine-node-new');
  
    /*grunt.registerTask('cleanup', 'cleans build tmp files', function(){
      var gruntConfig = grunt.config();
      grunt.file.delete(gruntConfig.concat.dist.dest);
    });*/
  
    grunt.registerTask('default', ['concat', 'uglify', 'jasmine_node', 'jasmine'/*, 'cleanup'*/]);
    grunt.registerTask('debug', ['concat', 'jasmine_node', 'jasmine']);
  
  
  };
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>&lt;html&gt;
      &lt;head&gt;
          &lt;% include partials/header.ejs %&gt;
          &lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" /&gt;
          &lt;link rel="stylesheet" href="/css/lib.css"&gt;
          &lt;link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"&gt;
      &lt;/head&gt;
  
      &lt;body ng-app="rugCoPro" ng-controller="MainController as ctrl" layout="column"&gt;
          &lt;!script src="https://cdnjs.cloudflare.com/ajax/libs/angularjs-toaster/1.1.0/toaster.min.js"&gt;&lt;/script&gt;
  
          &lt;script src="/js/libs.js"&gt;&lt;/script&gt; 
          &lt;script src="/js/rugcopro.min.js"&gt;&lt;/script&gt; 
  ...
  </code></pre>