Controller function with funny behavior

Hello,

I need someone’s help to take a look at my project. I couldn’t find the source of the problem.

I have a private function name trigger in my SearchCtrl controller

    var trigger = new function(){
        alert('Alert Me!');
    };

The problem is, the function fires even though it was not called.

The only thing I did was defining the SearchCtrl in the $stateprovider

.state('app.search', {
    url: "/search",
    views: {
        'menuContent': {
            templateUrl: "app/search/search.html",
            controller: 'SearchCtrl'
        }
    }
})

You can clone and take a look at my full project here:
[https://github.com/izandotnet/ionicSideMenu.git][1]

Thank you.
[1]: https://github.com/izandotnet/ionicSideMenu.git

It’s ok guys. I just solved it myself by referring to here.

A different way of creating controllers compared to ionic templates.

Thanks