48126

Unable to instantiate module on production

Question:

I just pushed my program onto heroku and the page I had testing angular loaded with the following error:

Uncaught Error: [$injector:modulerr] Failed to instantiate module diceAngularApp due to: Error: [$injector:unpr] Unknown provider: t

It was working perfectly fine in development so I'm not sure what the problem could be. To see the error you can visit the page at www.firexion.com/dice

I'm not sure exactly where the problem could be located so I'm not sure exactly which code to share. Here's the link to the github for it: <a href="https://github.com/Firexion/hundred" rel="nofollow">https://github.com/Firexion/hundred</a>

My guess is it could be in the angular app.js maybe?:

'use strict'; angular .module('diceAngularApp', [ 'ngCookies', 'ngResource', 'ngSanitize', 'ngRoute' ]) .config(function ($routeProvider) { $routeProvider .when('/dice', { templateUrl: '../../views/dice/main.html', controller: 'DiceController' }) .otherwise({ redirectTo: '/dice' }); });

or maybe I included it wrong in my rails application javascript file, lumen.js:

// Lumen // Bootswatch //= require jquery-2.1.0 //= require jquery_ujs //= require lumen/loader //= require lumen/bootswatch // angular //= require angular/angular //= require angular/angular-cookies //= require angular/angular-resource //= require angular/angular-route //= require angular/angular-sanitize //= require angular/angular-scenario // dice //= require dice/app.js //= require dice/controllers/main.js //= require dice/dice.js

Thank you for whatever help you can provide.

Answer1:

My strong suspicion, based upon the fact that Angular is looking for a provider for the variable t and I am guessing you would not name a service/controller/etc. t is that you're using minification/compiler somewhere that is clobbering your variables.

To get around this and be safe with a compiler, you need to adjust your syntax. Full details <a href="https://docs.angularjs.org/api/auto/service/$injector" rel="nofollow">here</a> but the skinny is below.

myapp.config(['$routeProvider', function($routeProvider) { $routeProvider.when('hello/:queryId', { templateUrl: 'mypartial.html', controller: MyCtrl, controllerAs: 'myCtrl', resolve: { 'myParam': ['myService', '$route', function(myService, $route) { return myService.get($route.current.params.queryId); }] } });

Recommend

  • Mechanize not being installed by easy_install?
  • cannot run python script file using windows prompt
  • App for Mac App Store doesn't run when signed
  • WSO2 SSO always redirects to localhost:9443/samlsso
  • emacs lisp will not start
  • How to use a controller in an other file in Angularjs
  • Visual Studio: Garbled debug watch of std::string's?
  • Building project succeed with Access database, can search the data but cannot delete the record
  • WCF error “The X.509 certificate chain building failed” despite trusted root CA
  • How To Protect Database Files From Copying In Windows
  • How to store pointer to S3 objects in Amazon SimpleDB?
  • How to load a CascadeClassifier using Emgu c#
  • Find first match in table range
  • Ignore some files from SVN commit
  • What is the best way to include a style sheet for a specific page?
  • How to modify the HTML tag in Drupal 6?
  • netsh acl setting (need alternative method - registry settings?)
  • Servlet stops working on Tomcat server after some hits or time
  • how to set variables in a php include file?
  • Application level floating views with navigation in Android
  • Best way to dynamically load an xml configuration file into a Flex4/Flash movie at runtime?
  • Web.config system.webserver errors
  • How to generate and display a QR Code in ionic 2
  • Recording logins for password protected directories
  • Is calc() supported in html email?
  • req.body is undefined - nodejs
  • RectangularRangeIndicator format like triangular using dojo
  • Cross-Platform Protobuf Serialization
  • Modifying destination and filename of gulp-svg-sprite
  • Shallow update not allowed (git > 1.9)
  • Symfony2: How to get request parameter
  • Importing jscolor library in angular 2
  • Akka Routing: Reply's send to router ends up as dead letters
  • jqPlot EnhancedLegendRenderer plugin does not toggle series for Pie charts
  • How do I rollback to a specific git commit
  • Is there a mandatory requirement to switch app.yaml?
  • Revoking OAuth Access Token Results in 404 Not Found
  • C# - Getting references of reference
  • Exception on Android 4.0 `android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode)`
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass