urish / angular-moment

Moment.JS directives for Angular.JS (timeago and more)
MIT License
2.6k stars 397 forks source link

Cannot inject amMoment for configuration #262

Open meredrica opened 7 years ago

meredrica commented 7 years ago

Hello!

I cannot get the amMoment object injected in my angular app (written in timescript).

(function () {
  angular.module('app.config', ['angularMoment']);
}());

namespace app.config {
  angular
    .module('app.config')
    .config(AmMomentConfig);

  AmMomentConfig.$inject=['amMoment'];

  function AmMomentConfig($amMoment:any) {
    amMoment.setLocale('de-at');
  }
}

I also tried using the $injector like so:


namespace app.config {

  angular
    .module('app.config')
    .config(AmMomentConfig);

  AmMomentConfig.$inject=['$injector'];

  function AmMomentConfig($injector:any) {
    $injector.get('amMoment');
  }

}

injection works ($inject is there) but the moment i want to inject amMoment, I get an UnknownProvider error. Any idea what could go wrong here?