0
$scope.survey.pages[0].fields.push({
                    type:type,
                    required:false,
                    **checkbox:true,**
                    **ui:(this.checkbox)** ? 'checkbox' : 'radio',
                    quest:[{answer:''},{answer:''},{answer:''}],
                    id:'name'+(++$scope.name),
                    allowId:'allow'+$scope.name,
                    requireId:'require'+$scope.name,
                    otherId:'other'+$scope.name
                });

This is what i want, if the checkbox property is true than in the ui i want to assign the text 'checkbox' and if not, radio...what am i missing?

totothegreat
  • 1,633
  • 4
  • 27
  • 59

1 Answers1

0

Why not make the ui a function ie:

            $scope.survey.pages[0].fields.push({
                type:type,
                required:false,
                **checkbox:true,**
                **ui:function(){return (this.checkbox)** ? 'checkbox' : 'radio';},
                quest:[{answer:''},{answer:''},{answer:''}],
                id:'name'+(++$scope.name),
                allowId:'allow'+$scope.name,
                requireId:'require'+$scope.name,
                otherId:'other'+$scope.name
            });

test=[];
test.push({checkBox:true, ui: function(){return (this.checkBox? "TRUE":"FALSE")}});
test.push({checkBox:false, ui: function(){return (this.checkBox? "TRUE":"FALSE")}});
console.log(test[0].ui(), "    ", test[1].ui())
Paullo
  • 2,038
  • 4
  • 25
  • 50