2016-10-03 44 views
0

初始化上pagePush

<ons-template id="atendimento.html"> 
 
    <ons-page id="atendimento" ng-controller="MyCtrl" > 
 
    <ons-toolbar> 
 
     <section class="left"> 
 
     <ons-toolbar-button onclick="fn.open()"> 
 
      <ons-icon icon="menuic"></ons-icon> 
 
     </ons-toolbar-button> 
 
     </section> 
 
     <section class="center"> 
 
     Atendimento 
 
     </section> 
 
    </ons-toolbar> 
 

 
    <section class="showConsultores" ng-app="MyApp" >  
 
     <section class="slick-container"> 
 
     <slick infinite=true slides-to-show=3 slides-to-scroll=3> 
 
      <section class="slick-item" ng-repeat="image in images"> 
 
      <div><img src="{{ image.url }}" /></div> 
 
      </section> 
 
     </slick> 
 
     </section> 
 
    </section><!-- showCOnsultores --> 
 

 
    </ons-page> 
 
</ons-template>

角光滑滑块我有一个插件模板一个漂亮的滑块,我需要在此模板/页被推初始化。我怎样才能做到这一点? 我有一个模板,一个div到其与NG-应用程序= “MyApp的” 和NG-控制器= “MyCtrl”

这里是我已经做了:

var app = angular.module('MyApp', ['slickCarousel']) 
 
    .controller('MyCtrl', MyCtrl); 
 

 
function MyCtrl($http, $scope, $interval) { 
 

 
    $scope.images = [{ 
 
    url: 'http://1.gravatar.com/avatar/7b87e6452c01724c8e917c4e08dce2f7?s=90&d=mm&r=g' 
 
    }, { 
 
    url: 'http://www.guiadafarmacia.com.br/images/resized/images/screen_shot_2015-04-30_at_3_90_90.png' 
 
    }, { 
 
    url: 'http://www.guiadafarmacia.com.br/images/resized/images/screen_shot_2015-04-30_at_3_90_90.png' 
 
    }, { 
 
    url: 'http://www.guiadafarmacia.com.br/images/resized/images/screen_shot_2015-04-30_at_3_90_90.png' 
 
    }, { 
 
    url: 'http://www.guiadafarmacia.com.br/images/resized/images/screen_shot_2015-04-30_at_3_90_90.png' 
 
    }, { 
 
    url: 'http://www.jmensura.com.br/img/call_center.jpg' 
 
    }]; 
 
}

+0

你能提供你的模板(HTML)代码吗? – nikjohn

+0

当然。发布更新! –

回答

0

从它看起来像一个普通ng-if模块的文档被用来初始化转盘:

<slick ng-if="numberLoaded"> 
    <div ng-repeat="i in number"> 
     <div class="" ng-include="'tpl.html'"></div> 
    </div> 
</slick> 

您可以在状态/路由解析功能上设置numberLoaded(或其他触发标志)。不知道这是否有帮助