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;








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;










share|improve this question


























  • 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

















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;










share|improve this question


























  • 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













0












0








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;










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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

















  • 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












1 Answer
1






active

oldest

votes


















1
















Suppose you have a variable tvVar of class Tv



tvVar: Tv;


You can set the value by



tvVar[paramSelected] = valueEnteredInInput;





share|improve this answer
























    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
    );



    );














    draft saved

    draft discarded
















    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









    1
















    Suppose you have a variable tvVar of class Tv



    tvVar: Tv;


    You can set the value by



    tvVar[paramSelected] = valueEnteredInInput;





    share|improve this answer





























      1
















      Suppose you have a variable tvVar of class Tv



      tvVar: Tv;


      You can set the value by



      tvVar[paramSelected] = valueEnteredInInput;





      share|improve this answer



























        1














        1










        1









        Suppose you have a variable tvVar of class Tv



        tvVar: Tv;


        You can set the value by



        tvVar[paramSelected] = valueEnteredInInput;





        share|improve this answer













        Suppose you have a variable tvVar of class Tv



        tvVar: Tv;


        You can set the value by



        tvVar[paramSelected] = valueEnteredInInput;






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 28 at 9:00









        Seba CherianSeba Cherian

        1,1981 silver badge14 bronze badges




        1,1981 silver badge14 bronze badges





















            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.




















            draft saved

            draft discarded















































            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.




            draft saved


            draft discarded














            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





















































            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







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript