That looks super cool and clean, but it needs better integration with IDEs... private members used exclusively for host bindings/listeners will be marked as "unused"
Good question. For the effect() function, I think the concept is: don't use it unless you need to, and avoid over using it. But there are reasons to use it. One of the use cases from the official docs is "Adding custom DOM behavior that can't be expressed with template syntax", which would be the category that our example falls under in this case. Hope that helps
I hope they will improve the typing for "host". right now for instance it is possible to give any name for the click event function and it still would build.
I this case I do since I’m using the addClass() and removeClass() methods to toggle a class on the body element. If I were only binding the class on the host element then I wouldn’t need it. But, just to be clear, this is only for the example in this video. Binding a class on the host element does not require the renderer. Hope that helps.
That looks super cool and clean, but it needs better integration with IDEs... private members used exclusively for host bindings/listeners will be marked as "unused"
Thanks for nice examples, I'll keep it in mind 🤝
Great explanation! After watching this, I immediately changed all my event emitters to the new output function. Thanks Brian!
Nice example, what about to don't use effect practice?
Good question.
For the effect() function, I think the concept is: don't use it unless you need to, and avoid over using it. But there are reasons to use it.
One of the use cases from the official docs is "Adding custom DOM behavior that can't be expressed with template syntax", which would be the category that our example falls under in this case.
Hope that helps
I hope they will improve the typing for "host". right now for instance it is possible to give any name for the click event function and it still would build.
Great we moved everything from host to hostbinding decorator and now we should move it back again? Thats how we can keep stay busy right?
but what about type safety?
Yep, that's one of the downsides to the way that this has changed. Hopefully tooling will get better around this in the near future.
Do you still need renderer when using host binding?
I this case I do since I’m using the addClass() and removeClass() methods to toggle a class on the body element. If I were only binding the class on the host element then I wouldn’t need it.
But, just to be clear, this is only for the example in this video. Binding a class on the host element does not require the renderer.
Hope that helps.
@@briantreese Wow. Very clear. Thank you. I tried using it but it throws an error about not having a provider. I am using standalone components