Add onPageLoad to make it work with angularjs