javascript - Angularjs in Node-Webkit function lose $scope -


i've simple controller in application developed in node-webkit angular:

(function() { 'use strict';  angular     .module('antapp')     .controller('startmenucontroller', startmenucontroller);  function startmenucontroller($scope, $rootscope, $state){     var self = $scope;     self.app = $rootscope;      self.init = init;     self.startgame = startgame;      init();      function init(){      };      function startgame (){         $state.go('main');     }; }; 

})();

the strange thing (to me) is, when click on "startgame" button in html:

<div id="startmenupage" class="container-fluid full-page"> <div class="row">     <div class="col-md-4 col-md-offset-4" style="text-align: center">         <a ng-click="startgame()" class="btn btn-info sound-button">new game</a>     </div> </div> 

the "self" variable, reference $scope replaced "window" object of browser (nw) itself. $scope , $rootscope not case $state variable.

this scenario common 1 i've used many times when developing proper web application , i'm sure i'm missing on nw part.

thank in advance


Comments