mobiscroll在angularjs中加载页面时设置默认值
我正在为angularjs使用jquery mobiscroll。一切都按预期进行,但我想设置从服务器获取的值 我的指令 控制器 模板mobiscroll在angularjs中加载页面时设置默认值,angularjs,mobiscroll,Angularjs,Mobiscroll,我正在为angularjs使用jquery mobiscroll。一切都按预期进行,但我想设置从服务器获取的值 我的指令 控制器 模板 打开滚动条后,模型值将高亮显示,但我想通过以下方式在输入字段中自动设置值: .directive('mobiSelect', function() { return { restrict: 'A', scope: { ngModel: "=" }, link: function($scope, elemen
打开滚动条后,模型值将高亮显示,但我想通过以下方式在输入字段中自动设置值:
.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>