1

I've just added angular-leaflet-directive to my project and when I come to build it with Grunt, it's now failing. The dependency was added using bower. This project was built using the Yeoman angular-generator.

Here I'm including the leaflet-directive in my app.js

angular
  .module('statsApp', [
    'ngCookies',
    'ngResource',
    'ngSanitize',
    'ngRoute',
    'leaflet-directive'
  ])

And then for now, I simply have <leaflet></leaflet> in my view just to get things started.

When the Grunt build fails, I get this error message

    Error: [$injector:modulerr] Failed to instantiate module statsApp due to:
    Error: [$injector:modulerr] Failed to instantiate module leaflet-directive due to:
    Error: [$injector:nomod] Module 'leaflet-directive' 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.
Patrick Grimard
  • 7,033
  • 8
  • 51
  • 68

1 Answers1

1

This SO post solved my problem. It's not specific to the module I'm adding, but specific to Karma tests failing because they didn't know about the leaflet-directive module.

AngularJS Error: Module ngAnimate is not available

Community
  • 1
  • 1
Patrick Grimard
  • 7,033
  • 8
  • 51
  • 68
  • Thank you, exactly what I needed. In my yeoman app all I had to do was add 'bower_components/angular-leaflet-directive/dist/angular-leaflet-directive.js' to the files array of test/karma.conf.js. – Joseph Sheedy Jan 29 '15 at 21:12