mlFacets directive

Author: Dave Cassel  |  Category: Software Development

My group within MarkLogic is moving to using AngularJS for the front-end code of our MarkLogic applications. One of the things I like about AngularJS is how many directives are already out there, and thus available for us to use in MarkLogic-driven web applications.

Of course, not everything is already out there, and I want to make it as easy as possible to write new apps. I took the facets directive I’d built for the Demo Cat application, gave it its own GitHub repo, and registered it as a Bower plugin. You can now add the plugin to your application (“bower install ml-facets”) and then setting up facets is pretty straightforward:

You tell the directive where the facet values and the selected facets will be, and tell it what functions to call when a facet is clicked or cleared. The mlFacets repo includes an example use, complete with a simple Controller. You can also see how Demo Cat is using the directive to see it in a more detailed setting. This directive is useful for MarkLogic, but not dependent on it.

The plugin is brand new; I’m open to feedback on how to improve it. I’ll also be looking for other re-usable pieces that we can put in bower, and at some point I’ll work with Paxton to include this and some other bits in his yeoman generator for MarkLogic.

Tags: , , , ,

3 Responses to “mlFacets directive”

  1. Mohit Kr singh Says:

    Thank you , for sharing your wonderful knowlegde and experience. I often refer to your blog ,when ever i have confusion regarding ML. Its always a great help.

  2. Fabian Jaramillo Says:

    Hello David, Thank you for shared all your knowledge here, I was thinking if you know what is the best solution to do a Properties Facet Search. I will really appreciate if you could give any advice about this topic. Thanks again.

  3. Dave Cassel Says:

    Fabian, properties constraints are supported out of the box, but the docs say that you can only make a constraint, not a search. Since you’re asking on a facets blog post, I’m guessing you’d like to do a facet. My email is on the About page; if you send me more specifics about what you’re trying to do, I might have some ideas.

Leave a Reply