bookthief
bookthief

Reputation: 2451

Undefined error when trying to use ngDialog

I used bower to install the ngDialog module- see here I am trying to instantiate the module in my app.js file with the rest of my dependencies, like so:

var app = angular.module('myApp', [
    'ngResource',
    'ngRoute',
    'ngCookies',
    'ui.bootstrap',
    'ngDialog',
    'myApp.services',
    'myApp.directives',
    'myApp.controllers',

]);

but when I build the app and try to open it in a browser, I get a blank page and an error saying:

Uncaught Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:modulerr] Failed to instantiate module ngDialog due to:
Error: [$injector:nomod] Module 'ngDialog' is not available! You either misspelled the ...

Can anyone advise why?

Upvotes: 0

Views: 4465

Answers (2)

boatcoder
boatcoder

Reputation: 18107

This problem is an indication you did not include that javascript in your index.html file.

You have a javascript file that defines ngDialog, make sure it was loaded by the browser.

Upvotes: 3

MarcoS
MarcoS

Reputation: 17721

Probably your controller is not taking ngDialog as a dependency, so it is not available at runtime... Please check you do something like:

app.controller('YourController', function($scope, ..., ngDialog) {
    ...
});

Upvotes: 1

Related Questions