Closed govorov closed 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.
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!
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.
I close this PR now, todays release will allow usage of html in the message and dictDefaultMessage.
Great, thank you!
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.
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.
This is great, thank you! I will test it next week and of course let you know if any bugs will appear.
Hi again) I've made some changes you may find useful.
With the current version of the template Angular will escape dictDefaultMessage, so it is impossible to create custom html layout.
[innerHTML]
fixes that.According to documentation,
.dz-text
in template is not necessary.In some cases it is very useful to access
dropzone
instance from parent component.init
event exposes it.I think it's also worth thinking about refactoring code repeat in directive and component as they are much the same.