1

From server-side I get json-data which describes how my html code has to look. I don't get information about html-tags, though. I'm just getting an object like this:

sections: {
  section1: {
    subsection1: {
      title: 'MyTitle',
      type: 'checkbox',
      clean: true
    },
    subsection2: {
      title: 'MyTitle2',
      type: 'select'
    },
    subsection3: {
      title: 'MyTitle3',
      type: 'input'
    }
  },
  section2: {
    subsection1: {
    ...
    }
  }
  ...
}

Besides I have an object of values data.

And so on. Input coresponds to an input element, checkbox to checkbox and so on. Title is just a correcponding label to the element and clean is a property to display or don't display on different sections of site. I have limited amount of elements, just four of them (inputs, radio-buttons, checkboxes, selects) and unpredictable data about their combinations from server. (And sections are just a div elemnts with some styles, I think.) Somehow I have to turn it to html. Please, tell me how can I do that in Angular 2.

K.Rice
  • 599
  • 1
  • 8
  • 27
  • I think the nearly same question I have posted it here with more detaild level information. http://stackoverflow.com/questions/40786490/dynamically-load-html-template-in-angular2 – Partha Sarathi Ghosh Nov 25 '16 at 08:27

0 Answers0