shammon shammon - 1 year ago 1288
AngularJS Question

Perform onload() in ionic

I want to load a function when a page loads.So how to use native javascript onload function in ionic.Here is sample html page.

<ion-view title="Account" >
<ion-content class="has-header padding">
<button id="bt">test</button>

here is my javascript file

function testload(){

alert("page loaded");

I want to load the this when page is loaded.How it possible in ionicframework?

Answer Source

What about using the controller associated with that view?

.controller('YourCtrl', function($scope, $stateParams, Something) {
    alert("page loaded");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download