Jorge Corea Jorge Corea - 1 year ago 146
AngularJS Question

Failing to load an angular module

I'm a complete angular noob so I'm following some tutorials, using Angular 1.5.8; right now, following a video about the angular-local-storage module I get this error:

Uncaught Error: [$injector:modulerr]$injector/modulerr?p0=toDoApp&p1=Error%3A…Orion%2FProyectos%2FAngularLearning%2FtodoList%2Fangular.min.js%3A21%3A179)(…)

The whole log is:

Failed to instantiate module toDoApp due to:
Error: [$injector:nomod]$injector/nomod?p0=toDoApp
at file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:6:412
at file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:25:99
at b (file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:24:142)
at file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:24:385
at file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:39:471
at q (file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:7:355)
at g (file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:39:319)
at cb (file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:43:336)
at c (file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:20:390)
at Bc (file:///C:/Users/Orion/Proyectos/AngularLearning/todoList/angular.min.js:21:179

This is my HTML:
This is my HTML:

And my angular module where I need to use the local storage module:

Angular code

I've searched for solutions to this but I haven't found it, I hope someone can help me with this. Thanks in advance.

Answer Source

Your toDoApp module is never created, because its dependencies cannot be satisfied.

Here's your toDoApp creation:

var app = angular.module('toDoApp', [LocalStorageModule]);
//                                           ^
//                                          ???

What's LocalStorageModule here? It's a variable ; most likely undefined!

Angular expects in that list of dependencies, the modules' names -- plain, simple, Strings.
You want to use:

var app = angular.module('toDoApp', ['LocalStorageModule']);
//                                            ^
//                                       module name
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download