Add support for templates with leading whitespaces #725

Merged
merged 1 commit into from Jul 10, 2016

Projects

None yet

2 participants

@jozefizso
Contributor
jozefizso commented Jun 25, 2016 edited

Description

Schema Form templates must have the first DOM child node of type HTMLElement. This prevents us from defining template in <script> tags that are formatted and contain whitespace characters before first HTML element. Schema Form will fail on such templates.

This update will use the firstElementChild property to support templates with leading whitespaces.

<script type="text/ng-template" id="schf-template.html">
  <div>{{form.foo}}</div>
</script>
scope.form = [{
    type: 'template',
    template: '  <div>{{form.foo}}</div>',
    foo: "Hello World"
}];

Checklist

  • I have read and understand the CONTRIBUTIONS.md file
  • I have searched for and linked related issues
  • I have created test cases to ensure quick resolution of the PR is easier
  • I am NOT targeting main branch
  • I did NOT include the dist folder in my PR

@json-schema-form/angular-schema-form-lead

@Anthropic Anthropic merged commit c372bae into json-schema-form:development Jul 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment