Is it possible to convert a radio input value from a string to a number in Angular?

My radio button list displays the days of the week, with their corresponding values as weekday IDs in Number format. However, when I use Angular to bind these values in my form group, they are transformed into strings.

const currentHour = moment('08:00', 'hh:mm');
new Array(7).fill(null).forEach((acc, index) => {
  this.weekdays.push({
    day: Number(currentHour.weekday(index).format('d')),
    short: currentHour.weekday(index).format('dd'),
    long: currentHour.weekday(index).format('dddd')});
});
<div class="col weekdays" *ngFor="let weekday of weekdays">
  <input 
  formControlName="repeatEveryDay" 
  name="repeatEveryDay" 
  type="radio" 
  id="weekday-{{weekday.long | lowercase}}" 
  [value]="weekday.day" 
  [checked]="weekday.day == repeatEveryDay"
  >
  <label for="weekday-{{weekday.long | lowercase}}">{{weekday.short | uppercase}}</label>
</div>

Is there a way to retrieve the Number value, or is this just how Angular functions?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Exploring the seamless interaction between Ionic 2 and Laravel 5.2 through API integration

As a newcomer to Ionic 2 and Angular 2, I have a background in PHP and have developed my API in Laravel 5.2. Currently, my login URL is: http://www.website.com/api/v1/login This URL returns a token upon successful login. I have created a form in Ionic 2 ...

Issue encountered while attempting to utilize a basic redux reducer to define a boolean value, regarding a mismatch in overrides

Currently, I am working on a project to enhance my understanding of Redux and Typescript. I am still navigating through the learning curve in this area. Based on what I have learned from a book, I have established a "slice" that includes definitions for r ...

Experiencing the 'invalid_form_data' error while attempting to upload a file to the Slack API via the files.upload method in Angular 8

I am currently working on a project that involves collecting form data, including a file upload. I am trying to implement a feature where the uploaded file is automatically sent to a Slack channel upon submission of the form. Despite following the guidance ...

Tips for compacting JSON in Typescript

I have encountered a challenge in my coding where we are dealing with quite large data objects. I am exploring the possibility of compressing these data objects to reduce payload size. For instance, if our input json size is 2 MB, can it be compressed to a ...

Setting a value to a FormBuilder object in Angular 2 with Typescript

During my use of Reactive form Validation (Model driven validation), I encountered an issue with setting the value to the form object on a Dropdown change. Here is my Formgroup: studentModel: StudentModel; AMform: FormGroup; Name = new FormControl("", Va ...

Retrieve values from DynamoDB in their original Number or String formats directly

Here is the code I am using to retrieve data from DynamoDB. async fetchData(params: QueryParams) { return await this.docClient.send(new QueryCommand(params)); } const dbObject: QueryParams = { TableName: process.env.TABLE_NAME, KeyCo ...

Modules cannot be compiled using the 'outFile' option unless the '--module' flag is set to 'amd' or 'system'

I am currently developing a Node-Mongodb server with Typescript and encountered this error during the build process: [14:57:05] Using gulpfile ~/Desktop/mean/gulpfile.js [14:57:05] Starting 'default'... [14:57:05] Finished 'default' af ...

What is causing checkboxes to malfunction within a form?

In my project, I have an array of objects representing pets: pets = [{key: 'dog', isChecked: true}, {key: 'hamster', isChecked: false}, {key: 'cat', isChecked: false}]; I want to display these objects as checkboxes. Here is ...

Unable to transfer object from Angular service to controller

I am currently utilizing a service to make a $http.get request for my object and then transfer it to my controller. Although the custom service (getService) successfully retrieves the data object and saves it in the responseObj.Announcement variable when ...

Error on the main thread in NativeScript Angular for Android has not been caught

As a beginner in the field of mobile development, I am currently exploring NativeScript and encountering an error in my Android application. https://i.stack.imgur.com/BxLqb.png You can view my package.json here ...

Integrating Paytm with Angular 6: A Step-by-

I am currently facing an issue where I am not being redirected to the paytm server's page after using the HTML form for integrating paytm in PHP. Can anyone provide assistance with this matter? ...

What is the correct way to understand nested and intricate types in Typescript?

There seems to be an issue with Typescript not properly inferring complex and nested types at times. I'm trying to figure out if this is a bug or if there's a mistake on my end. And if it's a mistake on my end, what is the most effective wa ...

Error 404: Webpack Dev Server Proxy Not Found

Recently, I joined a new team where I am tasked with getting familiar with the project code as a freshman. The project is built using Angular2 and Spring Boot, along with Webpack for bundling assets and proxy settings through Webpack Dev Server to connect ...

Retrieve selected button from loop typescript

https://i.stack.imgur.com/DS9jQ.jpgI have an array of individuals that I am looping through. It's a bit difficult for me to explain, but I want something like this: <div *ngFor="let person of persons"> {{person.name}} {{person.surname}} <but ...

Unable to retrieve information from a function in Vue.js (using Ionic framework)

When attempting to extract a variable from a method, I encounter the following error message: Property 'commentLikeVisible' does not exist on type '{ toggleCommentLikeVisible: () => void; This is the code I am working with: <template& ...

Differentiate the array type within an object in TypeScript

I understand how to specify the type for a variable. let members: string[] = [] // this example works flawlessly My goal is to have an array of strings within an object. How can I structure it correctly? const team = { name: String, members<st ...

Is React Typescript compatible with Internet Explorer 11?

As I have multiple React applications functioning in Internet Explorer 11 (with polyfills), my intention is to incorporate TypeScript into my upcoming projects. Following the same technologies and concepts from my previous apps, I built my first one using ...

Hierarchy-based state forwarding within React components

As I embark on the journey of learning Typescript+React in a professional environment, transitioning from working with technologies like CoffeeScript, Backbone, and Marionettejs, a question arises regarding the best approach to managing hierarchical views ...

Finding and retrieving specific information from nested arrays within a JSON object can be done by implementing a method that filters the data

I have an array of objects where each object contains a list of users. I need to be able to search for specific users without altering the existing structure. Check out the code on StackBlitz I've tried implementing this functionality, but it's ...

TypeDoc is having trouble locating the Angular 2 modules

Currently, I am attempting to create documentation files using TypeDoc. When executing TypeDoc with the command below: /node_modules/.bin/typedoc --module system --target ES5 --exclude *.spec.ts* --experimentalDecorators --out typedoc app/ --ignoreCompile ...