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: angularjs, bower, demo-cat, javascript, marklogic
May 6th, 2014 at 7:07 am
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.
September 9th, 2014 at 6:58 pm
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.
September 10th, 2014 at 7:06 am
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.