AngularJS Error - Failed to instantiate module ngIdle - angularjs

I have an Angular app reporting a persistent error.
Failed to instantiate module ngIdle due to ...
Error: $injector:nomod
Module Unavailable
Module 'ngIdle' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
After manually adding module via npm install ng-idle, I keep getting the error in my browser. I even see angular idle dir in my node-modules directory.
How do I resolve this?
app.js declaration
var app =angular.module('app', ['ngResource', 'LocalStorageModule', 'ui.router', 'kendo.directives', 'datatables' , 'datatables.bootstrap', 'datatables.scroller', 'angularMoment', 'ngAnimate','ngIdle']);

My index.html was missing the following line
<script src="resources/js/idlejs/angular-idle.js"></script>
Adding the line resolved the error.

Related

Angular - Module 'angulike' is not available! Error - don't know why?

I am trying to use angulike and have included it in my dependencies. I am also using gulp so there can't be a loading /script issue.
I keep getting the error:
[$injector:modulerr] Failed to instantiate module FullstackGeneratedApp due to:
Error: [$injector:modulerr] Failed to instantiate module angulike due to:
Error: [$injector:nomod] Module 'angulike' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
If I 'move' 'angulike' to the end, I sometimes get the same error but it says 'fsaPreBuilt' is not available instead..Its so frustrating and I don't know why this is happening!
window.app = angular.module('FullstackGeneratedApp', ['fsaPreBuilt', 'angulike', 'ui.router', 'ui.bootstrap', 'ngAnimate', 'ui.materialize', 'angular-input-stars', 'angular-stripe']);

Module 'lokijs' is not available

I am new in ionic I want to use offline data storage in my app. for that I use lokiJS in my ionic app.
I used "bower install lokijs --save" for add js.
but when I add lokijs dependency in my app.module like
angular.module('starter', ['ionic', 'lokijs'])
then it show error like below:
Error: [$injector:modulerr] Failed to instantiate module lokijs due to:
Error: [$injector:nomod] Module 'lokijs' is not available! You either misspelled the module name or forgot to load it."
How can I fix this issue?

In angularJS, having trouble instantiating main module

Every time I try to inject a dependency, I get this error:
Uncaught Error: [$injector:modulerr] Failed to instantiate module marbleApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngRoute due to:
Error: [$injector:nomod] Module 'ngRoute' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
I started with this, and my code ran fine:
var app = angular.module("marbleApp", []);
But then when I try to inject a dependency like this, I get the above error...
var app = angular.module("marbleApp", ["ngRoute"]);
Any thoughts on why this could be happening?
remember that you have to check two things when you want to inject some dependencies:
First:
var myModule = angular.module('myModule', [
'myDependency',
'mySecondDependency'
]);
Second:
myModule.config(['myDependency', 'mySecondDependency',
function(myDependency, mySecondDependency) {
//here you can use injected stuff
}
]);
Cheers!
Did you install angular-route, to start with?
$ bower install angular-route
If you want to update your bower.json, too:
$ bower install angular-route --save
More, as the comment from #ddepablo suggests, double check you have it added in your index.html file:
<script src="angular-route.js">
(see https://docs.angularjs.org/api/ngRoute)

AngularJS LocalStorageModule is not available

I'm attempting to get a brand new Ionic project working with angular-local-storage with no luck. I'm somehow referencing angular-local-storage incorrectly, but I don't know how.
https://github.com/grevory/angular-local-storage
ionic start myApp tabs
cd myApp
ionic platform add ios
ionic build ios
bower install angular-local-storage
// app.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'LocalStorageModule'])
Then
ionic serve
Error
Uncaught Error: [$injector:modulerr] Failed to instantiate module starter due to:
Error: [$injector:modulerr] Failed to instantiate module LocalStorageModule due to:
Error: [$injector:nomod] Module 'LocalStorageModule' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
What simple thing am I missing?
I'm not familiar with ionic, but it looks to me like you're missing the script.
Are you sure that you have the script included on the page? I'd confirm that bower did indeed install the script where you think it should be and then make sure its actually referenced before this error is thrown.
Guy should need to check that have you added link to it's script
src="https://rawgit.com/grevory/angular-local-storage/master/dist/angular-local-storage.min.js"
using <script></script> tag in your index file. It might be the issue. For the guys who will see this in future.

Error: [$injector:nomod] Module 'ui.bootstrap' is not available! while Karma run in webstorm

Hi I'm getting the following error in webstorm while running karma test run
Error: [$injector:nomod] Module 'ui.bootstrap', 'ui.unique' is not available!
You either misspelled the module name or forgot to load it.
If registering a module ensure that you specify the dependencies as the second argument.
i looked in the internet and they said to check dependency file ui.bootstrap might be missed like that.
but the application works fine
and while testing only it shows this error
in my karma.conf.js
files: [
//angular files
'app/js/vendor/angular/ui.bootstrap.js',
'app/js/vendor/angular/ui.bootstrap-0.10.0.js',
'app/js/vendor/angular/angular.js',
'app/js/vendor/angular/angular-mocks-0.10.6.js',
'app/js/app.js',
'test/**/*Spec.js'
],
in my Module declartion
var myApp = angular.module('myApp', ['ui.bootstrap']);
Could you please help ??
ui.unique is a module from angular-ui-utils. That has to be included in karma conf and injected to the app as well, if being used.
var myApp = angular.module('myApp', ['ui.bootstrap', 'ui.utils']);
or you can specifically inject ui.unique instead of injecting ui.utils, if only unique module is used.

Resources