Leaflet - Auto user location

hi all,
I am trying to follow the Leaflet procedure given here with a great working example to automatically locate use in my Ionic app. However I have some trouble finding the correct syntax to embeed the code given on the leaflet page with mine.

Full question and code on Stackoverflow

Thanks for you help.