Issue
this is not a code-based question moreover this is theoretical, can anyone explain to me "Why would use renderer methods instead of using native element methods"? in angular. I have searched but I can't get a proper idea.
Solution
There is Security Reason For this
According to Angular docs Security:
Use this API
as the last resort when direct access to DOM is needed. Permitting direct access to the DOM can make your application more vulnerable to XSS attacks.
Alternatively, you take a look at Renderer which provides API that can safely be used even when direct access to native elements is not supported.
So Render2
is always prefered over directly manipulating DOM using nativeElement
Answered By - LALIT KANTA DIBYADARSHAN
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.