siddii / angular-timer

re-usable/inter-operable AngularJS timer directive ⛺
http://siddii.github.io/angular-timer/
MIT License
793 stars 939 forks source link

humanizeDuration is not defined #214

Open jeffryang24 opened 9 years ago

jeffryang24 commented 9 years ago

I use requirejs for loading my module. In requirejs, I add below code:

require.config({
          baseUrl: 'libs'.
          paths: {
                 'angular': 'path/to/angular',
                 'angular-timer': 'angular-timer/dist/angular-timer.min',
                 'humanize-duration': 'path/to/humanize',
                 'moment': 'path/to/moment'
          },
         shim: {
                'angular-timer': ['angular', 'moment', 'humanize-duration']
         }
});

But, the console always said that humanizeDuration is not defined, but moment is defined inside angular-timer.min.js

jeffryang24 commented 9 years ago

Solved!!!! I just add these code to the beginning line of angular-timer.min.js


var humanizeDuration = require("humanize-duration");   // same like my requirejs shim. Also from the humanizeDuration docs at https://github.com/EvanHahn/HumanizeDuration.js
var moment = require("moment");  // same like my requirejs shim
shonatodc commented 8 years ago

This did NOT work, and the fact that we have to add this to core code smells. This shouldn't be closed, it's still an issue.

siddii commented 8 years ago

agreed.. been wanting to refactor/remove this dependency. But, haven't got a chance

santekotturi commented 8 years ago

any update on this? Looks like these dependencies are still there and the lib doesnt work with the way its currently documented (just importing lib/angular-timer/dist/angular-timer.js )

PradipShrestha commented 8 years ago

Any update on this. I am facing same error with all js file reference.

PradipShrestha commented 8 years ago

The way I am currently able to work with webpack is to add plugin as: new webpack.ProvidePlugin({ 'moment': 'moment', 'humanizeDuration': 'humanize-duration' })

jacqueslareau commented 8 years ago

This issue needs to be reopened.

LeoJavaAI commented 8 years ago

yup just faced this issue

LeoJavaAI commented 8 years ago

not sure how i should fix as i do not use require or webpack

PradipShrestha commented 8 years ago

Leo-G: In that case, won't adding dependencies js: moment and humanizeDuration before angular-timer fix the issue?

LeoJavaAI commented 8 years ago

I was hoping I did not have to install and load more dependencies in my app, but if thats the best solution then will do it

mattisx commented 7 years ago

I'm just writing my own timer, I can't stand any unnecessary dependencies.

m477r33d commented 7 years ago

+1 same issue.

My Solution: I added the .js files for moment and humanize-duration to my project directly from bower_components.

ghost commented 7 years ago

having same issue why this issue is closed ?

7medina commented 7 years ago

+1 same issue.

ghost commented 7 years ago

Same issue here..

evankleist commented 7 years ago

Same issue

johntiger1 commented 6 years ago

same

JMooreWeb commented 6 years ago

I got it to work by adding humanize-duration.js and moment.js after angular-timer.min.js.
Its dependent on these other 2 libraries. Get the libraries from Github.

jijeshkj commented 6 years ago

i have the same issue "humanizeDuration is not defined" in including angular timer
how to solve that ?

kondalraodurgam commented 4 years ago

I'm getting same error humanizeDuration is not defined...???