3

I have the following inputs.

 <input type="radio" id="someId" name="someName" value="1" [(ngModel)]="someArray]"/>
<input type="radio" id="someId" name="someName" value="2" [(ngModel)]="someArray]"/>
<input type="radio" id="someId" name="someName" value="3" [(ngModel)]="someArray]"/>

The are getting stored to array as ["1", "2", "3"] as strings. I need them to store to the array as integers. How can I achiveve this?

1
  • In angular 1.x this was done with $parsers/$formatters I think in NG 2 the idea is to use "pipes" to achieve the same kind of functionality, would look into those. Commented Aug 19, 2016 at 1:13

1 Answer 1

1

I figured it out. [value] = "some array"

The brackets keep the type intact.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.