angular formly ngOptions选择的值

时间:2016-05-12 15:32:21

标签: javascript angularjs

我可以填充我的选择,但我无法确定如何将所选值放在我的响应中:

{
    "pitId": 1223,
    "jobGrpId": 68021,
    "groupId": "P33",
    "companyCd": 42,
    "companyCdDescr": "Pierre TEST",

}

这是我的动态选择:

                {
                className: 'col-xs-4',                               
                type: 'select',
                key: 'companyCd',
                templateOptions: {
                    label: $translate.instant('pit.detail.companyCode'),
                    valueProp: 'id',
                    labelProp: 'descr',                                    
                    options: [],
                    ngOptions: "option as option.id + ' - ' + option.descr for option in to.options",
                    disabled: disabled
                },
                expressionProperties: {
                    'templateOptions.label': '"pit.detail.companyCode" | translate'
                },
                controller: /* @ngInject */ function ($scope, dataservice) {
                    return dataservice.getCompanyCodes().then(function (response) {
                        $scope.to.options = response.data;
    >>>>>>>???<<<<<<<<< $scope.model.companyCd.selectedItem = model["companyCd"];
                        console.log(model["companyCd"]);                                       
                        return response;
                    });
                ]

如何在此控制器中选择一个值?

万分感谢你的帮助!

0 个答案:

没有答案