# ember-get-all-model

> Shortcut for get all locally or remotely and select using modelName

Latest version **0.0.1** (published 2018-05-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install ember-get-all-model
pnpm add ember-get-all-model
yarn add ember-get-all-model
bun add ember-get-all-model
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2018-05-25 |
| First published | 2018-03-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | ^4.5 \|\| 6.* \|\| >= 7.* |
| Dependencies | 3 |
| Unpacked size | 12.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Beto Cantu |
| Maintainers | betocantu93 |
| Keywords | ember-addon, utils, productivity, select, picker |

## Links

- npm: https://www.npmjs.com/package/ember-get-all-model
- Issues: https://github.com/betocantu93/ember-get-all-model/issues
- npm.io page: https://npm.io/package/ember-get-all-model

## Dependencies (3)

- [ember-cli-babel](https://npm.io/package/ember-cli-babel.md) ^6.6.0
- [ember-cli-htmlbars](https://npm.io/package/ember-cli-htmlbars.md) ^2.0.1
- [ember-power-select](https://npm.io/package/ember-power-select.md) ^2.0.0-beta.3

## Recent versions

- 0.0.1 (latest) — 2018-05-25
- 0.0.0-alpha0.0.18 — 2018-03-15
- 0.0.0-alpha0.0.17 — 2018-03-15
- 0.0.0-alpha0.0.16 — 2018-03-14
- 0.0.0-alpha0.0.15 — 2018-03-14
- 0.0.0-alpha0.0.14 — 2018-03-14
- 0.0.0-alpha0.0.13 — 2018-03-14
- 0.0.0-alpha0.0.12 — 2018-03-14
- 0.0.0-alpha0.0.11 — 2018-03-14
- 0.0.0-alpha0.0.1 — 2018-03-14

## README

# ember-get-all-model


This is a shortcut for get all locally or remotely using `modelName` and select, if you use block form, the objects will be yielded, if not, a select-autocomplete using ember-power-select addon will be placed. Feel free to contribute.


## DEMO
[Ember-get-all-model DEMO](http://albertocantug.com/ember-get-all-model/)

## Installation

    $ ember install ember-get-all-model

## Properties

  `customRendering`: Boolean, tells the component to use power select or just yield the options to the consumer

  `reload`: Boolean, tells the component to query or peekAll using the modelName

  `required`: Boolean, if true, the component will bubble onValidChange with true/false

  `customValidation`: Function, will be bubbled when selectedObject changes, with (object) as params use it for any other custom validation, just return a bool.

  `filters`: Object, it will be used in the query. Example

     filters: {
        scope: 5,
        name: "Tomas"
     }

   or you can simple use the hash helper in template like

      {{#get-all-model
        modelName="user"
        filters=(hash name="Alberto" include="city,car")
        onSelect=(action (mut selectedUser))
       }}

  will result in

    /users?filter[name]=Alberto&include=city,car

  `include`: String, will be used in the query

  `filterFunc`: Function, callback function which will be called with the results from peekAll(`modelName`), for every record `filterFunc` will be called with (object, objects) as params, just return a boolean and the objects will be filtered.

  **Notice this is not the matcher function used by ember-power-select** it's just a preliminary function for cleaning the set of peekAll


## Usage

Power select

    {{#get-all-model
      modelName="user"
      required=true
      onValidChange=(action (mut isUserValid))
      placeholder="Select a user"
      reload=false //change to true to a force reload, making a remote to query(modelName)
      onSelect=(action (mut selectedUser))
      customRendering=false
    as |user| }}

    {{user.name}} - {{user.age}}

    {{/get-all-model}}

Custom Rendering

    {{#get-all-model
      modelName="image"
      onSelect=(action (mut selectedImage))
      customRendering=true
      as |component object|}}

      <img class="flex-none" {{action "select" object target=component}} src={{object.url}}/>

    {{/get-all-model}}

---
_Source: https://npm.io/package/ember-get-all-model · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
