How does angular2 pass the properties of the current component to the native click event?

The normal click event in

angular2 is: (click) = "selectClass (classItem)", and classItem is a property in the current component, which is fine, but now you need to use native click events such as: onclick= "routerTo ()". How to pass the properties of the current component to this function?

Mar.04,2021

I really don't know what circumstances force you to use native onclick events.


angular belongs to the js framework and must be used in full. The original way to write it depends on how the source code of angular is written, otherwise your routerTo method will not be able to get it, right? There must be some rules when the framework gets the data, just like the selector, if you use the class selector in the source code and you use the Id tag, it certainly won't get it. -- in a general sense, angular has not learned much, and has not found a solution for the time being


you need to get NativeElement and add subscription events to it. For more information, please see https://codeshelper.com/a/11.

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf3512-316bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf3512-316bc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?