Giter Site home page Giter Site logo

manjunathkg / angular-json-editor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rodikh/angular-json-editor

0.0 2.0 0.0 970 KB

An angular wrapper for jdorn/json-editor

Home Page: http://rodikh.github.io/angular-json-editor

JavaScript 72.25% HTML 27.75%

angular-json-editor's Introduction

JSON Editor Angular directive

A directive that wraps jdorn's json-editor.

JSON Editor takes a JSON Schema and uses it to generate an HTML form.

For further information about supported schema properties and usage, check out the original json-editor.

Requirements

The module doesn't include the original json-editor code, but it is included in it's bower dependencies.

Installation

Install via bower

bower install angular-json-editor --save

Then include the directive and json-editor in your html (you can also use the minified versions)

<script src="bower_components/json-editor/dist/jsoneditor.js"></script>
<script src="bower_components/angular-json-editor/dist/angular-json-editor.js"></script>

Usage

The directive supports both synchronous and asynchronous values, all values can be either a scope object, or a promise returned from $q, $http, $timeout, $resource etc. Please check out demo/index.html and demo/app.js for an example usage of both scenarios.

Validation

The directive exposes an isValid property on the scope, which can be used to enable/disable show/hide buttons using ng-disabled/ng-enabled or ng-hide/ng-show.

<button type="button" ng-disabled="!isValid">Button 1</button>

Events

The directive allows you to pass a callback function through the on-change attribute that will be called whenever a change event is fired on the editor.

    <json-editor schema="mySchema" startval="myStartVal" buttons-controller="SyncButtonsController" on-change="onChange()">

Configuration and Plugins

Configuring the JSONEditor object for plugins and styling is possible by injecting the JSONEditorProvider to your config function and calling the configure method. The object you pass to configure will be merged with the JSONEditor object.

    angular.module('demoApp', ['angular-json-editor']).config(function (JSONEditorProvider) {
        JSONEditorProvider.configure({
            plugins: {
                sceditor: {
                    style: 'sce/development/jquery.sceditor.default.css'
                }
            },
            defaults: {
                options: {
                    iconlib: 'bootstrap3',
                    theme: 'bootstrap3',
                    ajax: true
                }
            }
        }); 
    });

Building

Clone the project, install bower and npm dependencies by running

bower install && npm install

If you dont have grunt-cli installed globally run npm install -g grunt-cli

Then run grunt and look in the dist folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.