yeah thats the beaviour you are describing for a typical SP hosted Add-In, it loads after by its nature. Is that not ok for you? For this kind of requirement I should go for the SP Hosted Add-In. Optionally, if you have the Content Search Web Part, this is a way to go - building a display template with a control template. More option.. Use a content editor web part and link to a JS file where you have the markup and JS.