Skip to content

lodash dependency is not satisfied #174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
OlegKonyk opened this issue Oct 14, 2015 · 9 comments
Open

lodash dependency is not satisfied #174

OlegKonyk opened this issue Oct 14, 2015 · 9 comments

Comments

@OlegKonyk
Copy link

version: 1.0.19

Latest update is relying on loads.
In case when loads is not imported somewhere else it breaks.
Below is error message:
Unknown provider: lodashProvider <- lodash <- datePickerDirective

Suggestion:
instead of _.get(scope.$parent, attrs.onSetDate) : undefined, we might use element.attr('onSetDate', undefined)

@th0th
Copy link

th0th commented Oct 14, 2015

The demo is broken as well, with the same error:

https://rawgit.com/g00fy-/angular-datepicker/master/app/index.html

@OlegKonyk
Copy link
Author

created pull request fixing this issue:
https://github.com/g00fy-/angular-datepicker/pull/175

@aigoncharov
Copy link
Contributor

Sorry, guys, i fucked up. Created pull request with a fix https://github.com/g00fy-/angular-datepicker/pull/176

@OlegKonyk
Copy link
Author

Issue is still present in version 1.0.20
Error: Can't find variable: _

Line 51 breaks it.

scope.callbackOnSetDate = attrs.onSetDate ? _.get(scope.$parent, attrs.onSetDate) : undefined;

That issue is fixed and tested in #175, using

scope.callbackOnSetDate = scope.$parent[attrs.onSetDate]

+ some condition handling

@aigoncharov
Copy link
Contributor

Check out 1.0.21
It can't be done like you suggested: if attr.onSetDate is a refference to a deeply nested field like 'a.b.callback' it won't work like that. That's why I used lodash. I'll check more thoroughly why lodash still doesnt work tomorrow. Sorry for the all inconviencies guys

@OlegKonyk
Copy link
Author

@keenondrums
I see... It might be the case...
Just wandering, how could you make 'lodash' injection? Do you have custom service/provider for 'lodash'?

p.s. I'm not an Angular guru, just trying to understand how to make it work, since libraries as 'lodash' or 'underscore' would be extremely useful... but it looks to me as we would try to inject jQuery... which is not a way.

@aigoncharov
Copy link
Contributor

https://github.com/g00fy-/angular-datepicker/pull/181
Deprecated lodash. Sorry for the inconvenience guys.
@OlegKonyk, i didnt inject it as an angular module, basically i added a bower dependency, so you had to execute bower install and a task runner like gulp or grunt had to inject all necessary bower dependencies into your angular-app.
Fortunately, I work with smart guys who pointed out there was not too much sanity in adding a heavy lib just for once func.

@dhcar
Copy link

dhcar commented Oct 19, 2015

+1 I'm getting "_ is not defined" with the on-set-date attribute

@dhcar
Copy link

dhcar commented Oct 19, 2015

I changed line 51 to

scope.callbackOnSetDate = attrs.onSetDate ? scope.$parent[attrs.onSetDate] : undefined;

And the problem is fixed

I was going to make a pull request but 1.0.22 also solves this: https://github.com/keenondrums/angular-datepicker/blob/75e51db51930229a7bd98c66d3c0efde5dd64d6c/dist/angular-datepicker.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants