New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

angular-query-builder

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-query-builder

Query builder as JSON from angular directive

latest
Source
npmnpm
Version
1.3.0
Version published
Weekly downloads
24
71.43%
Maintainers
1
Weekly downloads
 
Created
Source

angular-query-builder

Query builder as JSON from angular directive

Install

$ npm install -SE angular-query-builder

Add it as an angular dependency:

angular.module('app', [
    'ngQueryBuilder',
]);

Usage

Simply define an options object:

$scope.options = {
    fields: [
        { name: 'Firstname', value: 'firstname' },
        { name: 'Lastname', value: 'lastname' },
        { name: 'Birthdate', value: 'birthdate' },
        { name: 'City', value: 'city' },
        { name: 'Country', value: 'country' },
    ],

    // optional operators
    operators: [
        { name: 'AND', value: '$and' },
        { name: 'OR', value: '$or' },
    ],

    // ... and conditions
    conditions: [
        { name: 'equal', value: '$eq' },
        { name: 'is not equal', value: '$neq' },
        { name: 'less than', value: '$lt' },
        { name: 'less than or equal', value: '$lte' },
        { name: 'greater than', value: '$gt' },
        { name: 'greater than or equal', value: '$gte' },
    ],
};

Then add the directive to your view:

<div query-builder="options"></div>

You can now get the result as {{options.query}}

Templating

You can use your own template by setting a templateUrl in the directive:

<div query-builder="options" template-url="templateUrl"></div>

or

$scope.options = {
    templateUrl: '/src/query-builder-group-directive.html',
};

The template needs to be recursive. You can have a look at the project one.

Build

Just run npm run dev to start webserver, and build everything with npm run build

Want to help?

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes using commitizen (git commit -am 'feat: add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

License

MIT

Keywords

angular

FAQs

Package last updated on 26 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts