How to find class variable with string selected from DropDownHow can I select an element in a component template?How can I get new selection in “select” in Angular 2?Angular 2 template driven form with ngFor inputsDynamic forms angular2How can I bind select dropdown in angular2 using formBuilder?Set dropdown list default value or use value from modelClearing selection in an angular 2 semantic ui dropdownHow to use this pipe in angular 5 dynamically?Reset changes on angular reactive formGet selected values from multiple dynamically generated Mat Selection Lists in Angular
Will replacing a fake visa with a different fake visa cause me problems when applying for a legal study permit?
Were Roman public roads build by private companies?
How to help my 2.5-year-old daughter take her medicine when she refuses to?
Do Milankovitch Cycles fully explain climate change?
How to work with a technician hired with a grant who argues everything
How do you build a Dominant 7th chord?
Contract Employer Keeps Asking for Small Things Without Pay
Why is the T-1000 humanoid?
Is English tonal for some words, like "permit"?
Converting multiple assignment statements to single comma separated assignment
How to save PDFs from web for offline reading on an iPad?
How does Vivi differ from other Black Mages?
Can I toggle Do Not Disturb on/off on my Mac as easily as I can on my iPhone?
Why does F + F' = 1?
My employer wants me to do a work of 6 months in just 2 months
Using the pipe operator ("|") when executing system commands
What does "synoptic" mean in avionics?
Are there any instances of members of different Hogwarts houses coupling up and marrying each other?
Kerning feedback on logo
If you have multiple situational racial save bonuses and are in a situation where they all apply do they stack?
How to stabilise the bicycle seatpost and saddle when it is all the way up?
Have there been any countries that voted themselves out of existence?
Which ping implementation is Cygwin using?
Random point on a sphere
How to find class variable with string selected from DropDown
How can I select an element in a component template?How can I get new selection in “select” in Angular 2?Angular 2 template driven form with ngFor inputsDynamic forms angular2How can I bind select dropdown in angular2 using formBuilder?Set dropdown list default value or use value from modelClearing selection in an angular 2 semantic ui dropdownHow to use this pipe in angular 5 dynamically?Reset changes on angular reactive formGet selected values from multiple dynamically generated Mat Selection Lists in Angular
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a class Tv with some variables, which are string.
On the page I have DropDown list. I need user to select option from DropDown list and enter the value. And this value must be saved to Tv class variable, which has name like selected string.
Later I pass Tv object to my BackEnd.
My Tv class
export class Tv
id: number;
brand: string;
model: string;
color:string;
display_technology:string;
screen_size:string;
refresh_rate:string;
weight:string;
condition:string;
inputs:string;
My DropDown list
<select class="form-control col-md-3">
<option *ngFor="let param of parameters">param</option>
</select>
<div class="col">
<input type="text" class="form-control" id="paramer" required>
</div>
UPD Working version.
<div class="row">
<select name="tvParam" class="form-control col-md-3" [(ngModel)]="selectedParam">
<option *ngFor="let param of parametrs">param</option>
</select>
<div class="col">
<input type="text" class="form-control" name="tvParamValue" [(ngModel)] = "paramet" (change)="passData()">
</div>
passData()
this.tv[this.selectedParam.toLocaleLowerCase()] = this.paramet;
angular typescript
add a comment |
I have a class Tv with some variables, which are string.
On the page I have DropDown list. I need user to select option from DropDown list and enter the value. And this value must be saved to Tv class variable, which has name like selected string.
Later I pass Tv object to my BackEnd.
My Tv class
export class Tv
id: number;
brand: string;
model: string;
color:string;
display_technology:string;
screen_size:string;
refresh_rate:string;
weight:string;
condition:string;
inputs:string;
My DropDown list
<select class="form-control col-md-3">
<option *ngFor="let param of parameters">param</option>
</select>
<div class="col">
<input type="text" class="form-control" id="paramer" required>
</div>
UPD Working version.
<div class="row">
<select name="tvParam" class="form-control col-md-3" [(ngModel)]="selectedParam">
<option *ngFor="let param of parametrs">param</option>
</select>
<div class="col">
<input type="text" class="form-control" name="tvParamValue" [(ngModel)] = "paramet" (change)="passData()">
</div>
passData()
this.tv[this.selectedParam.toLocaleLowerCase()] = this.paramet;
angular typescript
Did my solution work? @Vitalii Pshenychniuk
– Seba Cherian
Mar 28 at 9:07
Thank you very much! @SebaCherian
– Vitalii Pshenychniuk
Mar 28 at 10:14
add a comment |
I have a class Tv with some variables, which are string.
On the page I have DropDown list. I need user to select option from DropDown list and enter the value. And this value must be saved to Tv class variable, which has name like selected string.
Later I pass Tv object to my BackEnd.
My Tv class
export class Tv
id: number;
brand: string;
model: string;
color:string;
display_technology:string;
screen_size:string;
refresh_rate:string;
weight:string;
condition:string;
inputs:string;
My DropDown list
<select class="form-control col-md-3">
<option *ngFor="let param of parameters">param</option>
</select>
<div class="col">
<input type="text" class="form-control" id="paramer" required>
</div>
UPD Working version.
<div class="row">
<select name="tvParam" class="form-control col-md-3" [(ngModel)]="selectedParam">
<option *ngFor="let param of parametrs">param</option>
</select>
<div class="col">
<input type="text" class="form-control" name="tvParamValue" [(ngModel)] = "paramet" (change)="passData()">
</div>
passData()
this.tv[this.selectedParam.toLocaleLowerCase()] = this.paramet;
angular typescript
I have a class Tv with some variables, which are string.
On the page I have DropDown list. I need user to select option from DropDown list and enter the value. And this value must be saved to Tv class variable, which has name like selected string.
Later I pass Tv object to my BackEnd.
My Tv class
export class Tv
id: number;
brand: string;
model: string;
color:string;
display_technology:string;
screen_size:string;
refresh_rate:string;
weight:string;
condition:string;
inputs:string;
My DropDown list
<select class="form-control col-md-3">
<option *ngFor="let param of parameters">param</option>
</select>
<div class="col">
<input type="text" class="form-control" id="paramer" required>
</div>
UPD Working version.
<div class="row">
<select name="tvParam" class="form-control col-md-3" [(ngModel)]="selectedParam">
<option *ngFor="let param of parametrs">param</option>
</select>
<div class="col">
<input type="text" class="form-control" name="tvParamValue" [(ngModel)] = "paramet" (change)="passData()">
</div>
passData()
this.tv[this.selectedParam.toLocaleLowerCase()] = this.paramet;
angular typescript
angular typescript
edited Mar 28 at 10:13
Vitalii Pshenychniuk
asked Mar 28 at 8:55
Vitalii PshenychniukVitalii Pshenychniuk
93 bronze badges
93 bronze badges
Did my solution work? @Vitalii Pshenychniuk
– Seba Cherian
Mar 28 at 9:07
Thank you very much! @SebaCherian
– Vitalii Pshenychniuk
Mar 28 at 10:14
add a comment |
Did my solution work? @Vitalii Pshenychniuk
– Seba Cherian
Mar 28 at 9:07
Thank you very much! @SebaCherian
– Vitalii Pshenychniuk
Mar 28 at 10:14
Did my solution work? @Vitalii Pshenychniuk
– Seba Cherian
Mar 28 at 9:07
Did my solution work? @Vitalii Pshenychniuk
– Seba Cherian
Mar 28 at 9:07
Thank you very much! @SebaCherian
– Vitalii Pshenychniuk
Mar 28 at 10:14
Thank you very much! @SebaCherian
– Vitalii Pshenychniuk
Mar 28 at 10:14
add a comment |
1 Answer
1
active
oldest
votes
Suppose you have a variable tvVar of class Tv
tvVar: Tv;
You can set the value by
tvVar[paramSelected] = valueEnteredInInput;
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393511%2fhow-to-find-class-variable-with-string-selected-from-dropdown%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Suppose you have a variable tvVar of class Tv
tvVar: Tv;
You can set the value by
tvVar[paramSelected] = valueEnteredInInput;
add a comment |
Suppose you have a variable tvVar of class Tv
tvVar: Tv;
You can set the value by
tvVar[paramSelected] = valueEnteredInInput;
add a comment |
Suppose you have a variable tvVar of class Tv
tvVar: Tv;
You can set the value by
tvVar[paramSelected] = valueEnteredInInput;
Suppose you have a variable tvVar of class Tv
tvVar: Tv;
You can set the value by
tvVar[paramSelected] = valueEnteredInInput;
answered Mar 28 at 9:00
Seba CherianSeba Cherian
1,1981 silver badge14 bronze badges
1,1981 silver badge14 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55393511%2fhow-to-find-class-variable-with-string-selected-from-dropdown%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Did my solution work? @Vitalii Pshenychniuk
– Seba Cherian
Mar 28 at 9:07
Thank you very much! @SebaCherian
– Vitalii Pshenychniuk
Mar 28 at 10:14