I need to print countries based on option selected in array in my code dynamicallyBinding select element to object in AngularHow do you remove all the options of a select box and then add one option and select it with jQuery?What is the best way to add options to a select from as a JS object with jQuery?Adding options to a <select> using jQuery?Frame Buster Buster … buster code neededSimplest code for array intersection in javascriptSelecting last element in JavaScript arrayjQuery Get Selected Option From DropdownWorking with select using AngularJS's ng-optionsReact JSX: selecting “selected” on selected <select> optionAngularJS - select option and use it in a function

Metric version of "footage"?

When is pointing out a person's hypocrisy not considered to be a logical fallacy?

Does Google Maps take into account hills/inclines for route times?

Too many spies!

Rearranging the formula

latinate or other words of foreign origin as opposed to Germanic words

Ambiguous sentences: How to tell when they need fixing?

P-MOSFET failing

How do I write a romance that doesn't look obvious

nginx serves wrong domain site. It doenst shows default site if no configuration applies

Why would guns not work in the dungeon?

Why did my rum cake turn black?

Is `curl something | sudo bash -` a reasonably safe installation method?

Filtering fine silt/mud from water (not necessarily bacteria etc.)

Can a continent naturally split into two distant parts within a week?

Is it rude to tell recruiters I would only change jobs for a better salary?

How might the United Kingdom become a republic?

What is the English equivalent of 干物女 (dried fish woman)?

I quit, and boss offered me 3 month "grace period" where I could still come back

Can anybody provide any information about this equation?

As a DM, how to avoid unconscious metagaming when dealing with a high AC character?

Why does java.time.Period#normalized() not normalize days?

Can you negate disadvantage on throwing a net by using the Lunging Attack maneuver of the Battle Master fighter?

Fix /dev/sdb after using dd with no device inserted



I need to print countries based on option selected in array in my code dynamically


Binding select element to object in AngularHow do you remove all the options of a select box and then add one option and select it with jQuery?What is the best way to add options to a select from as a JS object with jQuery?Adding options to a <select> using jQuery?Frame Buster Buster … buster code neededSimplest code for array intersection in javascriptSelecting last element in JavaScript arrayjQuery Get Selected Option From DropdownWorking with select using AngularJS's ng-optionsReact JSX: selecting “selected” on selected <select> optionAngularJS - select option and use it in a function






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I need simple code help. If I choose any particular letter then corresponding countries should be displayed, in my current position I am not able to do it dynamically.
For example if i choose letter A then countries pertaining to those should be displayed outside the select.



<select [(ngModel)]="selectedOption">
<option *ngFor="let o of options">
o.letter
</option>
</select>

<p *ngFor="let o of options">Countries are: o.countries </p>



export class AppComponent 
selectedOption: string;

options = [
letter: "A", countries: ["Afghanistan", "Albania", "Argentina"] ,
letter: "B", countries: ["Bangladesh", "Bahamas", "Bahrain"]
]





If A chosen then Afghanistan Albania ....
If B chosen then ....
If C chosen then .... I should be able to expand array in future.










share|improve this question




























    2















    I need simple code help. If I choose any particular letter then corresponding countries should be displayed, in my current position I am not able to do it dynamically.
    For example if i choose letter A then countries pertaining to those should be displayed outside the select.



    <select [(ngModel)]="selectedOption">
    <option *ngFor="let o of options">
    o.letter
    </option>
    </select>

    <p *ngFor="let o of options">Countries are: o.countries </p>



    export class AppComponent 
    selectedOption: string;

    options = [
    letter: "A", countries: ["Afghanistan", "Albania", "Argentina"] ,
    letter: "B", countries: ["Bangladesh", "Bahamas", "Bahrain"]
    ]





    If A chosen then Afghanistan Albania ....
    If B chosen then ....
    If C chosen then .... I should be able to expand array in future.










    share|improve this question
























      2












      2








      2


      1






      I need simple code help. If I choose any particular letter then corresponding countries should be displayed, in my current position I am not able to do it dynamically.
      For example if i choose letter A then countries pertaining to those should be displayed outside the select.



      <select [(ngModel)]="selectedOption">
      <option *ngFor="let o of options">
      o.letter
      </option>
      </select>

      <p *ngFor="let o of options">Countries are: o.countries </p>



      export class AppComponent 
      selectedOption: string;

      options = [
      letter: "A", countries: ["Afghanistan", "Albania", "Argentina"] ,
      letter: "B", countries: ["Bangladesh", "Bahamas", "Bahrain"]
      ]





      If A chosen then Afghanistan Albania ....
      If B chosen then ....
      If C chosen then .... I should be able to expand array in future.










      share|improve this question














      I need simple code help. If I choose any particular letter then corresponding countries should be displayed, in my current position I am not able to do it dynamically.
      For example if i choose letter A then countries pertaining to those should be displayed outside the select.



      <select [(ngModel)]="selectedOption">
      <option *ngFor="let o of options">
      o.letter
      </option>
      </select>

      <p *ngFor="let o of options">Countries are: o.countries </p>



      export class AppComponent 
      selectedOption: string;

      options = [
      letter: "A", countries: ["Afghanistan", "Albania", "Argentina"] ,
      letter: "B", countries: ["Bangladesh", "Bahamas", "Bahrain"]
      ]





      If A chosen then Afghanistan Albania ....
      If B chosen then ....
      If C chosen then .... I should be able to expand array in future.







      javascript angular typescript






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 5:37









      R.HR.H

      8710 bronze badges




      8710 bronze badges






















          2 Answers
          2






          active

          oldest

          votes


















          2














          You can use ngValue instead of using ngFor.
          You can refer this answer.
          Here is the working example.



          Your code becomes



          <select [(ngModel)]="selectedOption">
          <option *ngFor="let o of options" [ngValue]="o">
          o.letter
          </option>
          </select>

          <!-- Just to debug and display selected object -->
          json

          <p>selectedOption.countries</p>





          share|improve this answer






























            0














            You can try this



            <p *ngFor="let o of options">
            <label *ngIf="o.letter === selectedOption">Countries are: o.countries <label>
            </p>





            share|improve this answer

























            • Template parse errors: Can't have multiple template bindings on one element

              – R.H
              Mar 26 at 5:43











            • I've modified the answer. Could you try that?

              – Seba Cherian
              Mar 26 at 5:45














            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/3.0/"u003ecc by-sa 3.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%2f55350479%2fi-need-to-print-countries-based-on-option-selected-in-array-in-my-code-dynamical%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            You can use ngValue instead of using ngFor.
            You can refer this answer.
            Here is the working example.



            Your code becomes



            <select [(ngModel)]="selectedOption">
            <option *ngFor="let o of options" [ngValue]="o">
            o.letter
            </option>
            </select>

            <!-- Just to debug and display selected object -->
            json

            <p>selectedOption.countries</p>





            share|improve this answer



























              2














              You can use ngValue instead of using ngFor.
              You can refer this answer.
              Here is the working example.



              Your code becomes



              <select [(ngModel)]="selectedOption">
              <option *ngFor="let o of options" [ngValue]="o">
              o.letter
              </option>
              </select>

              <!-- Just to debug and display selected object -->
              json

              <p>selectedOption.countries</p>





              share|improve this answer

























                2












                2








                2







                You can use ngValue instead of using ngFor.
                You can refer this answer.
                Here is the working example.



                Your code becomes



                <select [(ngModel)]="selectedOption">
                <option *ngFor="let o of options" [ngValue]="o">
                o.letter
                </option>
                </select>

                <!-- Just to debug and display selected object -->
                json

                <p>selectedOption.countries</p>





                share|improve this answer













                You can use ngValue instead of using ngFor.
                You can refer this answer.
                Here is the working example.



                Your code becomes



                <select [(ngModel)]="selectedOption">
                <option *ngFor="let o of options" [ngValue]="o">
                o.letter
                </option>
                </select>

                <!-- Just to debug and display selected object -->
                json

                <p>selectedOption.countries</p>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 5:47









                Laxmikant DangeLaxmikant Dange

                5,7013 gold badges31 silver badges57 bronze badges




                5,7013 gold badges31 silver badges57 bronze badges























                    0














                    You can try this



                    <p *ngFor="let o of options">
                    <label *ngIf="o.letter === selectedOption">Countries are: o.countries <label>
                    </p>





                    share|improve this answer

























                    • Template parse errors: Can't have multiple template bindings on one element

                      – R.H
                      Mar 26 at 5:43











                    • I've modified the answer. Could you try that?

                      – Seba Cherian
                      Mar 26 at 5:45
















                    0














                    You can try this



                    <p *ngFor="let o of options">
                    <label *ngIf="o.letter === selectedOption">Countries are: o.countries <label>
                    </p>





                    share|improve this answer

























                    • Template parse errors: Can't have multiple template bindings on one element

                      – R.H
                      Mar 26 at 5:43











                    • I've modified the answer. Could you try that?

                      – Seba Cherian
                      Mar 26 at 5:45














                    0












                    0








                    0







                    You can try this



                    <p *ngFor="let o of options">
                    <label *ngIf="o.letter === selectedOption">Countries are: o.countries <label>
                    </p>





                    share|improve this answer















                    You can try this



                    <p *ngFor="let o of options">
                    <label *ngIf="o.letter === selectedOption">Countries are: o.countries <label>
                    </p>






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Mar 26 at 6:01









                    Bhagwat Tupe

                    8054 silver badges19 bronze badges




                    8054 silver badges19 bronze badges










                    answered Mar 26 at 5:40









                    Seba CherianSeba Cherian

                    8791 silver badge14 bronze badges




                    8791 silver badge14 bronze badges












                    • Template parse errors: Can't have multiple template bindings on one element

                      – R.H
                      Mar 26 at 5:43











                    • I've modified the answer. Could you try that?

                      – Seba Cherian
                      Mar 26 at 5:45


















                    • Template parse errors: Can't have multiple template bindings on one element

                      – R.H
                      Mar 26 at 5:43











                    • I've modified the answer. Could you try that?

                      – Seba Cherian
                      Mar 26 at 5:45

















                    Template parse errors: Can't have multiple template bindings on one element

                    – R.H
                    Mar 26 at 5:43





                    Template parse errors: Can't have multiple template bindings on one element

                    – R.H
                    Mar 26 at 5:43













                    I've modified the answer. Could you try that?

                    – Seba Cherian
                    Mar 26 at 5:45






                    I've modified the answer. Could you try that?

                    – Seba Cherian
                    Mar 26 at 5:45


















                    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%2f55350479%2fi-need-to-print-countries-based-on-option-selected-in-array-in-my-code-dynamical%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

                    SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

                    은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현