-
Notifications
You must be signed in to change notification settings - Fork 77
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
Webpack #52
Comments
Got it: import mdDateTimePicker from "md-date-time-picker";
...
var dateDialog = new mdDateTimePicker({
type: 'date'
}); |
@jolic also the new keyword will be like this in v2.0.0
Feel free to close this issue if it is resolved 😄 |
I'm just inspecting the source and I think it would be better to provide callbacks on the constructor: var dateDialog = new mdDateTimePicker({
type: "date"
,past: moment().subtract(3, 'years')
,future: moment()
,onClick: function(date){
console.log(date);
}
,onOk: function(date){
console.log(date);
}
,onCancel: function(date){
console.log(date);
}
});
...
function mdDateTimePicker(_ref) {
...
_ref$onClick = _ref.onClick,
onClick = _ref$onClick === undefined ? '' : _ref$onClick,
_ref$onOk = _ref.onOk,
onOk = _ref$onOk === undefined ? '' : _ref$onOk,
_ref$onCancel = _ref.onCancel,
onCancel = _ref$onCancel === undefined ? '' : _ref$onCancel;
...
this._onClick = onClick;
this._onOk = onOk;
this._onCancel = onCancel;
...
value: function _addCellClickEvent(el) {
...
// update temp date object with the date selected
me._sDialog.sDate = currentDate.clone();
if (me._onClick) {
me._onClick(me._sDialog.sDate);
}
me._fillText(subtitle, currentDate.year());
.... |
With this you didn't depend on an element and it's clearer for the user... |
Maybe it would be nice to contribute the datepicker to https://github.com/tleunen/react-mdl |
@jolic i'll start a pr there in some time for the component (possibly two of them) About the callbacks can you start a PR? |
@jolic also if possible can this callback solution be done in a way that we don't have any breaking changes? Also, how does react mdl differ from material ui? Any ideas? |
hey guys, quick question: I'm using datetime picker in a project with Webpack. in my vendor.ts file I load moment and the datetime picker as follow
then in my angular2 component I'm using moment and the datetime picker like this
From my angular2 component I can use moment no problem but as soon as I initialize the datetime picker
it throws an exception any idea? Philippe |
@filoucpp you need to configure webpack as done here: or modify your require statements as
|
thanks for the answer, the only way I got it working was to write this:
once somewhere in the code, and then in every file that uses moment do this
thanks for the help!! |
@filoucpp congrats it worked for you and thanks for posting the answer too! It would help a lot of people in the future 😄 |
Could you please provide a clear example on using with code splitting and webpack? Tried numerous approaches and md-date-time-picker just does not work. vendors.ts
not working
Thanks in advance |
Hmm seems to be an issue |
Any updates on the issue? |
Cant say yet will try my best to release it asap. |
How can md-date-time-picker be used with Webpack? Any examples?
The text was updated successfully, but these errors were encountered: