ng2-ui / datetime-picker

Angular2 DateTime Picker
https://ng2-ui.github.io/#/datetime-picker
MIT License
121 stars 62 forks source link

formControl extension #35

Closed 0cv closed 8 years ago

0cv commented 8 years ago

implement https://github.com/ng2-ui/ng2-datetime-picker/issues/27#issuecomment-249426568

I have also moved all dependencies into devDependencies so to avoid conflicting Angular version when installing from Npm.

allenhwkim commented 8 years ago

This is wonderful, and thanks for your time and willingness to help others. I can learn things from your code.

It’s totally my fault not to have style guide here. However, I think we need to keep consistency all over ng2-ui.

This PR will be merged as it is, but plz don't get upset when code is changed to follow ng2-ui style, which is not documented yet.

About style; Everything is two-space indented even with package.json.

About code;

export class DateTimePickerDirective implements `OnInit`

ng2-ui do not use implements on components since it does not makes any difference. less code :) If you say it makes difference, I am listening.

private sub: any;

I would put some meaningful name with type like this private formControlValueChanged: Observer;

triggerChange

valueChanged looks very similar to me. It might be combined into a single function in the future.

@Optional() @Host() @SkipSelf() private parent: ControlContainer

I have never used these decorations. Can you give me some insights for it by adding some comments?

Overall, I am very excited to have these changes. This technique would be useful on other directives too. e.g., ng2-auto-complete.

@Krisa if you are interested in, I would like to invite you as a ng2-ui member, a volunteer to maintain these directives.

allenhwkim commented 8 years ago

published as 0.9.3

0cv commented 8 years ago

Yes sorry for having messed up slightly the syntax. I think it would be good to have an .editorconfig, along with a tslint to avoid most of these issues

Definitely interested to join the team. My time is limited but will be happy to contribute from time to time to this module since I use it in my project.