Argument of type { value: number} is not assignable to parameter of type 'AlertInputOptions'


#1

I am trying to pass a number parameter to the Alert attribute (value) but i am failing to do… I am looping through, but it give error Type of property ‘value’ are incompatible. Type ‘number’ is not assignable to type ‘string’ :

          alert.addInput({
             type: 'checkbox',
             label: entry.CourseName,
             value: entry.CourseID   
            });

This is my code:

   this.schoolAppUsers.loadAllCourses().subscribe(response => {

 
  for (let entry of response)
  {
   
    alert.addInput({
      type: 'checkbox',
      label: entry.CourseName,
      value: entry.CourseID
      
    });
  }
})
alert.addButton('Cancel');
alert.addButton({
  text: 'Okay',
  handler: data => {
    console.log('Checkbox data:', data.CourseName);
    this.testCheckboxOpen = false;
    this.testCheckboxResult = data;
  }
});
alert.present().then(() => {
  this.testCheckboxOpen = true;
  });

This loadAllCourses() response returns objects like this :

  [{"CourseID":1,"CourseName":"Mathematics"},{"CourseID":5,"CourseName":"English Language"}]

Also , I am not sure if data.CourseName is correct

 console.log('Checkbox data:', data.CourseName);

Because I need to pass the selected data back to the server through the service ‘schoolAppUsers’

can someone help , thanx