zefoy / ngx-dropzone-wrapper

Angular wrapper library for Dropzone
MIT License
174 stars 51 forks source link

`init` event, html support for dictDefaultMessage #9

Closed govorov closed 7 years ago

govorov commented 7 years ago

Hi again) I've made some changes you may find useful.

I think it's also worth thinking about refactoring code repeat in directive and component as they are much the same.

sconix commented 7 years ago

Yes I plan to refactor the code, but atm angular does not support host directive which I think would make the code much nicer instead of making separate element for the directive inside the component. So I decided to wait a bit and see if host directives will be supported in near future.

What is the benefit of having the init event to expose the dropzone vs getting it via ViewChild?

Also what is the benefit of having the separate html for dictDefaultMessage? Why just not add the innerHTML for the div?

Don't get me wrong I am happy to make the changes, but I always want to keep the code to minimum and as clean as possible so I want to understand if there are some benefits with your solutions since my take on those changes would be bit different.

govorov commented 7 years ago

You're right, init event is unnecessary, I forgot about @ViewChild. What is the proper way to provide custom markup without refactoring the component template? All markup is escaped when I pass something like <h1>test</h1> to dictDefaultMessage or message. I've found that it's possible to pass unescaped markup via [innerHTML] : http://stackoverflow.com/questions/34585453/how-to-bind-raw-html-in-angular2

Thank you!

sconix commented 7 years ago

Yes I can change the way the message / dictDefaultMessage is used to the innerHTML I just meant that I dont think there needs to be alternate template since it can be done in one div. I will release new version today which allows using html in the message. Thanks for bringing that into my attention since I did not think at all that naturally someone might want to use html in the message.

sconix commented 7 years ago

I close this PR now, todays release will allow usage of html in the message and dictDefaultMessage.

govorov commented 7 years ago

Great, thank you!

sconix commented 7 years ago

Will have to delay new release by day or two since I am bringing support for latest angular-cli also and most likely for AOT at the same time.

sconix commented 7 years ago

I just release 2.0.0 which will allow html in dictDefaultMessage. It also has new build system which should produce aot compatible library to be used with latest angular / angular-cli. Also now there is a minified umd bundle version included. I tried to test this setup with as many different build systems I could, but if you run into problems then let me know.

govorov commented 7 years ago

This is great, thank you! I will test it next week and of course let you know if any bugs will appear.