javascript - Angularjs Failed to instantiate module WebApp due to: Error: at Anonymous function -


i've angularjs app, running in chrome , firefox , edge! though not on ie11.

i've tried wrapping init.js follows:

var webapp = angular.module('webapp', ['ngroute', 'ui.bootstrap', 'angular-mandrill', 'firebase']);

(function() {    angular.module('webapp').run(function($rootscope,$timeout) {           $timeout(function(){                    $rootscope.$on('$routechangesuccess', function(ev, data) {                     if (data && data.controller) {                         var controller = data.controller;                         controller = controller.charat(0).tolowercase() + controller.slice(1);                         controller = controller.replace(/controller/g, '');                         $rootscope.controller = controller;                     }                 });         }, 100);       }).$inject = ['$rootscope']; }).bind(window); 

i've tried wrapping controllers like:

(function (angular) { "use strict";

// controller in here }(window.angular));

anyone else have ideas? thanks!

edited! -- additional error stacks :) --

    html1300: navigation occurred. localhost:8000 script1006: expected ')' angular-mandrill.js (1,597) script5022: [$injector:modulerr] http://errors.angularjs.org/1.5.5/$injector/modulerr?p0=webapp&p1=error%3a%20%5b%24injector%3amodulerr%5d%20http%3a%2f%2ferrors.angularjs.org%2f1.5.5%2f%24injector%2fmodulerr%3fp0%3dangular-mandrill%26p1%3derror%253a%2520%255b%2524injector%253anomod%255d%2520http%253a%252f%252ferrors.angularjs.org%252f1.5.5%252f%2524injector%252fnomod%253fp0%253dangular-mandrill%250a%2520%2520%2520at%2520anonymous%2520function%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a25%253a229)%250a%2520%2520%2520at%2520b%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a24%253a263)%250a%2520%2520%2520at%2520anonymous%2520function%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a25%253a13)%250a%2520%2520%2520at%2520anonymous%2520function%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a39%253a372)%250a%2520%2520%2520at%2520q%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a7%253a353)%250a%2520%2520%2520at%2520g%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a39%253a222)%250a%2520%2520%2520at%2520anonymous%2520function%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a39%253a380)%250a%2520%2520%2520at%2520q%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a7%253a353)%250a%2520%2520%2520at%2520g%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a39%253a222)%250a%2520%2520%2520at%2520bb%2520(http%253a%252f%252flocalhost%253a8000%252fassets%252fexternal%252fangular%252fangular.min.js%253a43%253a240)%0a%20%20%20at%20anonymous%20function%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a40%3a25)%0a%20%20%20at%20q%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a7%3a353)%0a%20%20%20at%20g%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a39%3a222)%0a%20%20%20at%20anonymous%20function%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a39%3a380)%0a%20%20%20at%20q%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a7%3a353)%0a%20%20%20at%20g%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a39%3a222)%0a%20%20%20at%20bb%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a43%3a240)%0a%20%20%20at%20c%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a21%3a17)%0a%20%20%20at%20yc%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a21%3a325)%0a%20%20%20at%20ee%20(http%3a%2f%2flocalhost%3a8000%2fassets%2fexternal%2fangular%2fangular.min.js%3a20%3a156) angular.min.js (40,25) rendered http://localhost:8000/assets/css/style.less successfully. css http://localhost:8000/assets/css/style.less generated in 1641ms less has finished. css generated in 1641ms 

try this, should work :

(function() {    angular.module('webapp', ['ngroute', 'ui.bootstrap', 'angular-mandrill', 'firebase']);       angular.module('webapp').run(['$rootscope', '$timeout', function($rootscope, $timeout) {       $timeout(function() {         $rootscope.$on('$routechangesuccess', function(ev, data) {             if (data && data.controller) {                 var controller = data.controller;                 controller = controller.charat(0).tolowercase() + controller.slice(1);                 controller = controller.replace(/controller/g, '');                 $rootscope.controller = controller;             }         });     }, 100);      }]);  })(); ; 

error stacks shows module 'angular-mandrill' not available. ensure it's loaded before webapp module initialized.

add angular-mandrill.js html.

<script src="//rawgit.com/mrkvngrkn/angular-mandrill/master/dist/angular-mandrill.js"></script> 

then, add angular-mandrill module dependency app. same ui.bootstrap , firebase

angular.module('webapp', ['angular-mandrill']); 

Comments