Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 74074

ngSwitch for array of object for angular 7

$
0
0

I am trying to write a logic to handle ngswitchcase for the json response which have multiple objects.

Is it possible to handle the object inside the ngswitch and how?

I would like to make dynamic form based on the JSON.

For Example:

For this input form-control should be: option1 option1_text_box option2 option2_select_option option3 option3_select_option

options = [

    {
         'option_text': "option1",
        'secondary_element': {
          "text_box":{
            "name":"a1"
          }},

    },
    {
       'option_text': "option2",
        'secondary_element': {
          "select":{
            "select_type":"single",
            "options":["a1","a2","a3"]
          }},
    },
    {
       'option_text': "option3",
        'secondary_element': {
          "select":{
            "select_type":"multiple",
            "options":["b1","b2","b3"]
          }},
    },
];

the FormGroup should be here is my stackblitz

https://stackblitz.com/edit/angular-7aqzj2


Viewing all articles
Browse latest Browse all 74074

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>