1

I am using jquery mobiscroll for angularjs. Every thing was working as expected, but i want to set the value which is getting from the server.

my directive

.directive('mobiSelect', function() {
  return {
    restrict: 'A',
    scope: {
      ngModel: "="
    },

    link: function($scope, element, attrs) {      
      return $(element).mobiscroll().select({
        theme: 'android-ics light',
        display: 'modal',
        minWidth: 500,   
        headerText: 'Select Option'
      });    
    }
  };

});

controller

$scope.ptitle = [
  {code: 'Mr', description: 'Mr'}, 
  {code: 'Mrs', description: 'Mrs'}
]; 
//this value i received from server
$scope.personalDetails.title = 'Mr';

template

<select name="title" id="title" ng-options="option.code as option.description for option in ptitle" data-ng-model="personalDetails.title" ng-required="true" mobi-select=true>  
</select> 

The model value is highlighting once open the scroller, but i want to set the value automatically in input field in the following way: enter image description here

vishnu
  • 4,377
  • 15
  • 52
  • 89

0 Answers0