我正在使用jquery mobiscroll for angularjs。每件事都按预期工作,但我想设置从服务器获取的值。
.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'
});
}
};
});
$scope.ptitle = [
{code: 'Mr', description: 'Mr'},
{code: 'Mrs', description: 'Mrs'}
];
//this value i received from server
$scope.personalDetails.title = 'Mr';
<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>