How do I make services available outside of constructor in angular?
<p>I have the following problem. When I have a class in ionic with angular I can access angular services in the constructor after injecting them:</p>

<pre><code>export class HomeController {
    static $inject = [
        '$scope',
        '$state'
    ];

    constructor(
       public $scope : any,
       public $state : any
    ) {
        this.$state.go('test');
        this.$scope.changeController = this.changeController;
    }

    changeController() {
        console.log("change controller");
    };
}
</code></pre>

<p>However when I change it to the change controller function, it doesn't work</p>

<pre><code>export class HomeController {
    static $inject = [
        '$scope',
        '$state'
    ];

    constructor(
       public $scope : any,
       public $state : any
    ) {
        this.$scope.changeController = this.changeController;
    }

    changeController() {
        console.log("change controller");
        this.$state.go('test'); // Fails here
    };
}
</code></pre>

<p>This is the error: </p>

<blockquote>
  <p>Error: undefined is not an object (evaluating 'this.$state.go')</p>
</blockquote>

<p>What can I do?</p>

<p>On top of that, is it correct add the changeController function to the scope or is there an easier method to make it available to a template?</p>

<p>Thx in advance</p>