Is there any plugin/documentation about adding angularjs applications inside grav? I mean: an html form with some custom tags and some javascript code…
Thanks
Matteo
Is there any plugin/documentation about adding angularjs applications inside grav? I mean: an html form with some custom tags and some javascript code…
Thanks
Matteo
You mention forms, so first I’ll link to the Forms docs.
You can certainly provide an Angular app in a Grav theme, by adding the JS / markup needed.
The only issue you’ll probably get into is Twig using the same brackets as Angular, if you define your app in Twig files, but there are solutions for this.
If you need Grav to provide data, you can create a JSON endpoint very simply, by having a (example) todos.json.twig
file in your template, and have a page called todos.md
under /user/pages/api/todos
. Calling yoursite.com/api/todos.json
will invoke such json.twig file. What you output there is up to you, you can iterate over some YAML defined inside the page, or build a plugin that exposes some objects to Twig, even calling from a DB, network call or whatever.
If you need to build a more advanced API, I once did this p roof of concept which can be a starting point: https://github.com/flaviocopes/grav-plugin-api. Development halted as we’ll implement it in the core at some point.