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.

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.