2014-07-11 60 views
4

我試過

  • $ stateChangeSuccess,
  • $ routeChangeSuccess和
  • $ viewContentLoaded

,但我不能讓我的自定義jQuery的初始化函數我NG-後運行包括負載,或者如果我用ng-swith在事實之後切換它。

Index.html具有ng-view to dashboard.html,它具有此代碼。

<div class="row"> 
    <div class="col-md-12"> 
     Switch Dashboard View: <input type="radio" name="dashboardView" value="0" ng-model="vm.dashboardView" />Franchisee | 
     <input type="radio" name="dashboardView" value="1" ng-model="vm.dashboardView" />Real Estate 
    </div> 
</div> 
<!--tiles end--> 
<div data-ng-switch="vm.dashboardView"> 
    <div data-ng-switch-when="0"> 
     <div data-ng-include="'/Views/Dashboard/FranchiseeDashboard.html'"></div> 
    </div> 
    <div data-ng-switch-when="1"> 
     <div data-ng-include="'/Views/Dashboard/RealestateDashboard.html'"></div> 
    </div> 
</div> 

的index.html有具有這種

$rootScope.$on("$viewContentLoaded", function() { 
     Interactions.init(); 

    }); 
    $rootScope.$on('$stateChangeSuccess', 
     function (event, next, current) { 
      Interactions.init(); 
     } 
    ); 
    $rootScope.$on('$routeChangeSuccess', 
     function (event, next, current) { 
      Interactions.init(); 
     } 
    ); 

我怎樣才能獲得後NG-開關已加載的我jQuery的功能以觸發控制器NG-包括哪些內容?

回答

相關問題