Skip to content

CSS messed up after getting schema and form data from api call. #701

Open
@rnjailamba

Description

@rnjailamba

Expected behaviour

Earlier within my angular controller i was directly setting the schema and form variables like -

      vm.schema =
                    {
                      "type": "object",
                      "title": "Comment",
                      "properties": {
                        "name": {
                          "title": "Name",
                          "type": "string"
                        },
                        "email": {
                          "title": "Email",
                          "type": "string",
                          "pattern": "^\\S+@\\S+$",
                          "description": "Email will be used for evil."
                        },
                        "comment": {
                          "title": "Comment",
                          "type": "string",
                          "maxLength": 20,
                          "validationMessage": "Don't be greedy!"
                        }
                      },
                      "required": [
                        "name",
                        "email",
                        "comment"
                      ]
                    };

    vm.form =
        [
          {
            "type": "help",
            "helpvalue": "<div class=\"alert alert-info\">Grid it up with bootstrap</div>"
          },
          {
            "type": "section",
            "htmlClass": "row",
            "items": [
              {
                "type": "section",
                "htmlClass": "col-xs-6",
                "items": [
                  "name"
                ]
              },
              {
                "type": "section",
                "htmlClass": "col-xs-6",
                "items": [
                  "email"
                ]
              }
            ]
          },
          {
            "key": "comment",
            "type": "textarea",
            "placeholder": "Make a comment"
          }

        ]  ;

Actual behaviour

Now i am calling the node.js server to get this dynamic data.

        DialogService.getDynamicFormData().then(function(data) {
           vm.schema = data["schema"];
           vm.form = data["form"];
       });

However this results in the css getting messed up.

I couldnt see any visible changes in html after the change

I did an html diff and got this -
https://www.diffnow.com/?report=6bnli
Notable stuff is that
before md-tab-data had following style glued to it - style="max-width: 392px;"
now md-tab-data has following style glued to it - style="max-width: 295px;"
I will attach the photos of before and after.

Gist/Plunker/Demo

Before
After

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions