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

            How to preserve electronics (computers, tablets and phones) for hundreds of years Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) The network's official Twitter account is up and running again. What content…How might modern humans leave a message for 50,000 years?How would an aquatic race develop computers?How do we make computers care for human life?Keeping supplies for 1000 yearsWhat will cell phones become in 100 years?What body armor protects against a laser?Could a society attain 1800s technology if limited to using copper and bronze?Electricity power (magic) and electronicsScavenging metal resources in post-apocalypse after 100 yearsWhy would precursors create devices that can survive and still work after hundreds of years?

            155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해

            Convert JSON to MapSimplest way to convert a string representing JSON array into Java array List of key value pairsHow to take String JSON values into HashMapConvert a JSON String to a HashMapCreating BSON object from JSON stringJSONObject - How to get a value ?Better Map ConstructorReading JSON from Url javaUpdate columns if input values are not null otherwise ignore and keep the existing values of column in databaseHow to store object represented as Json string into Couchbase Lite?Go JSON into MapHow do I efficiently iterate over each entry in a Java Map?Sort a Map<Key, Value> by valuesHow to round a number to n decimal places in JavaCan comments be used in JSON?How do I read / convert an InputStream into a String in Java?How can I pretty-print JSON in a shell script?What is the correct JSON content type?How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?Why does Google prepend while(1); to their JSON responses?Parse JSON in JavaScript?