2016-07-31 30 views
2

我正在试图让Mobiscroll与Ionic一起工作,但似乎无法实现它?Mobiscroll和Ionic执行

这是我正在做的。我已经实现jQuery和mobiscroll这样的:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> 
    <title></title> 

    <link href="lib/ionic/css/ionic.css" rel="stylesheet"> 
    <link href="css/style.css" rel="stylesheet"> 

    <link href="css/mobiscroll.custom-2.14.4.min.css" rel="stylesheet" type="text/css" /> 

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above 
    <link href="css/ionic.app.css" rel="stylesheet"> 
    --> 

    <!-- ionic/jquery js --> 
    <script src="lib/jquery/jquery-1.11.3.js"></script> 

    <!-- ionic/angularjs js --> 
    <script src="lib/ionic/js/ionic.bundle.js"></script> 

    <!-- cordova script (this will be a 404 during development) --> 
    <script src="cordova.js"></script> 

    <!-- your app's js --> 
    <script src="js/app.js"></script> 
    <script src="js/controllers.js"></script> 
    <script src="js/mobiscroll.custom-2.14.4.min.js"></script> 
    </head> 

    <body ng-app="myApp"> 
    <ion-nav-view></ion-nav-view> 
    </body> 
</html> 

我有那么我controllers.js做到了这一点:

angular.module('myApp.controllers', []) 

.controller('mobiCtrl', function ($scope) { // create controller for the module 
    // create function which calculates the age given the birthday as a datetime object 
    $scope.settings = { 
     theme: 'ios', 
     display: 'bottom', 
     group: true 
    }; 
}); 

最后,在我的start.html做到了这一点:

<ion-view view-title="Start"> 
    <ion-content ng-controller="MyController"> 

    <div ng-controller="mobiCtrl"> 
     <select ng-model="myselect" mobiscroll-select="settings"> 
      <optgroup label="A"> 
       <option value="Alan">Alan</option> 
       <option value="Anderson">Anderson</option> 
      </optgroup> 
      <optgroup label="E"> 
       <option value="Eva">Eva</option> 
       <option value="Esther">Esther</option> 
      </optgroup> 
      <optgroup label="M"> 
       <option value="Michael">Michael</option> 
       <option value="Margared">Margared</option> 
      </optgroup> 
     </select> 
    </div> 

    </ion-content> 
</ion-view> 

现在,Mobiscroll不显示,但显示常规选择字段!?

我已经在网上搜索了关于这个的教程,但没有运气...有没有人成功地集成了mobiscroll离子或我做这一切都是错误的?

希望能帮助和在此先感谢:-)

回答

0

因为你还没有注入mobiscroll选择模块它是最有可能的。我知道你提到jquery,但我认为你正在尝试角实现,因为你正在创建一个设置对象的范围。

,这样就会将解决你的问题,或者至少让你更近了一步:

angular.module('myApp.controllers', ['mobiscroll-select'])