rackerlabs/rs-facet — pull request #2 by bradgignac (2014-12-19 15:58:02+00:00)
Title: docs(README): add proposed API for facet directives

This pull request documents a proposed API for faceting directives. The basic structure and usage of these directives has been extracted from Mailgun's control panel. The API more or less matches the Mailgun-specific implementation, but a few Mailgun-specific features have been removed. Here's a simple example of how these directives could be used to build a simplified version of the [faceting demo](http://rackerlabs.github.io/canon/ui-components/#facets) on the Canon site:

```html

{{ tag.name }}

{{ status.name }}

```

```js
$scope.tags = [{ name: 'Development', count: 3 }, { name: 'Staging', count: 1 }];
$scope.statuses = [{ name: 'Error', icon: 'error', count: 2 }, { name: 'Rebooting', icon: 'warning', count: 3 }];

$scope.facet = function (type, values) {
// Update data to match the selected facet type and values.
// In Mailgun, this is typically handled by redirecting to a route with parameters that match facet values and data is loaded using ui-router's `resolve` hooks.
var params;

params = {};
params[type] = values;

$state.go('servers.list', params);
};
```

To start the discussion, here are a few questions that I have regarding the above implementation:

1. Is this something you are interested in at all?
1. What would you need to build on top of this API for it to be useful in your application?
1. Do you foresee any issues with the proposed API? Is is too restrictive?