I want to call a function that is inside a component from the browser console. I want something like this but equivalent to angular 6.
Thank you in advance
If this function is inside a closure, Then you can't call from the console. Otherwise, you just do functionName(); and hit return.
To invoke this function in the html document, we have to create a simple button and using the onclick event attribute (which is an event handler) along with it, we can call the function by clicking on the button.
Yes you can check by below method..
on your google chrome console, you can run below command
ng.probe($0).componentInstance.<name of function you want to run from component.ts file>
You can check the output.
Do let me know if you need further clarification.
Please check reference for better understanding.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With