Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining the "Basic Usage" #3

Open
ThomasPe opened this issue Apr 19, 2016 · 8 comments
Open

Defining the "Basic Usage" #3

ThomasPe opened this issue Apr 19, 2016 · 8 comments

Comments

@ThomasPe
Copy link

ThomasPe commented Apr 19, 2016

So we can work towards a common goal I'd like to discuss how exactly the Json Schema Builder should be used / called / included.
I created a small "Basic Usage" example based on the Angular Schema Form Example.
As I see it, it should be enough to just have a $scope.schema and a $scope.form (and an optional $scope.options) object for passing & receiving data, right?

Here's what I think it could look like (from my fork)

First, expose your (existing) schema and form to the $scope.

angular.module('myModule', ['schemaFormBuilder'])
       .controller('FormBuilderController', function($scope) {
  // JSON Schema
  // add an existing schema to edit it
  // or leave blank to create a new form
  $scope.schema = {};

  // Schema Form Defintion
  // add an existing form definition for editing
  // or leave blank to create a new form
  $scope.form = [];


});

Then load them into the Schema Form Builder using the sfbSchema and sfbForm directives.

<div ng-controller="FormBuilderController">
    <div sfb-schema="schema" sfb-form="form"></form>
</div>

Thoughts?

@nicklasb
Copy link
Member

Well, yeah, something like that would be the usage, I suppose.
As close as the normal ASF usage as possible.

Have you looked closer to see if it easy to break out a directive from the application?

@nicklasb
Copy link
Member

Took a quick look, and the code seems really nice, it should be pretty easy to break that out.

@ThomasPe
Copy link
Author

I'm currently working on that. There's some functionality in there that does not belong into the library IMHO, like saving forms or notifying the user of changes (locker, growl).
But the code is well-structured, so it's certainly possible. I'll have to read up on some angular convetions & best practices first, though.

@nicklasb
Copy link
Member

Please do, it would be a killer feature if you could get that done.

@ThomasPe
Copy link
Author

I'm gonna need this for my masters thesis, so eventually I'll have to ;-)

@nicklasb
Copy link
Member

Good choice. :-)

@Anthropic
Copy link
Member

I'm partial to: https://github.com/johnpapa/angular-styleguide
The material repo also has a jscs file that follows Google code guide with minor differences, but I haven't looked into the builder enough to know how appropriate that is, however it would be nice to follow the same guides across all js implementations within the org. That's my 2c :)

@ThomasPe
Copy link
Author

Thanks, I'll give it a look and try to abide by it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants