zakmac / ember-cli-filter-component

A simple Ember.js component used to filter an array based on user input.
MIT License
14 stars 4 forks source link

ember-cli-filter-component

Ember Observer Score Shields.io Build Status

Table of Contents

About

ember-cli-filter-component provides a {{filter-content}} block component for filtering arrays of items.

Installation

cd /path/to/projects/cool-project
ember install ember-cli-filter-component

Usage

Sample template

{{#filter-content content=ingredients properties="name" as |filteredIngredients query|}}
  {{input value=query}}
  {{#each filteredIngredients as |ingredient|}}
    {{! ... }}
  {{/each}}
{{/filter-content}}

Block parameters

{{filter-content as |filtered query|}}

filtered {array}

query {string}

Properties

content (required) {array.<array, object>}

properties (required) {string}

timeout {number}

query {string}

Development

To start developing/testing locally, clone the project to your machine.

cd /path/to/projects
git clone git@github.com:zakmac/ember-cli-filter-component.git

Once cloned, you can start editing and testing in the project folder itself, or include the addon in another project via npm link.

Link ember-cli-filter-component to your project

# create an npm link from the project directory
cd /path/to/projects/ember-cli-filter-component
npm link

# include the npm link in your project
cd /path/to/projects/cool-project
npm link ember-cli-filter-component

The last step is to add "ember-cli-filter-component": "" to the devDependencies section of your project's package.json.

Next time your project is run, the filter-content component will be accessible.

Running tests

The command ember test will run the test suite via CLI, outputting results.

You can also run ember test --server to launch a Test'em browser session.

License

This project is licensed under the MIT License.


For more information on using ember-cli, visit http://www.ember-cli.com/.
For more information on Ember.js, visit http://www.emberjs.com/.