mlFacets directiveAuthor: 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.