Ionic - called multiple times



I am puzzled, I am trying to initialize some stuff at application startup, but it seems that the .run element is called multiple times, every time a page changes.

var starter = angular.module('starter', ['ionic']) ($rootScope) {
    if ($rootScope.ifVarInitialized != 1) {
        alert('This is a run element.');
        $rootScope.ifVarInitialized = 1;

What’s more, I wrote above to try to supress multiple execution of some code, but the alert pops up multiple times also, so are the $rootScope values somehow resetted as well? Is this a normal behaviour?

I tried the same with .config - identical outcome.

Maybe the problem is connected with the fact that in the project there is used switching between sites with the means of normal html links? Maybe I should instead use changing states/views/pushing?

Versions: Ionic: 1.3.1 IONIC CLI: 2.1.17 Cordova CLI: 6.4.0