AngularJS Directly in Experience Pages

Regarding the pages under the experience section:

Does the HTML page type support Angular directives (e.g., ng-repeat, ng-if, etc.) directly within the HTML tags?

Or is it limited to just HTML and handlebars?

Here’s what I mean:

Is that possible or would I need to serve an Angular project through the Files?

Thanks,
Karim

Hi @Karim_Kabbara, and welcome to the Losant Forums.

I don’t know much about Angular but I can tell you the following and hopefully it will answer your question …

  • Experience pages are rendered server-side in response to experience endpoint requests. Pages optionally are rendered within a layout (usually the common HTML boilerplate like the <head> and <!doctype> tags and such) and they may also include reusable components. But the key thing here is it’s all rendered server-side as a full document and returned to the browser making the request as such.
  • As such, pages are not bundled and returned to the browser the way a single-page application would work.
  • You certainly can add Angular directive attributes to the HTML you put in those pages, if you include a script file (served from a CDN or from your application files) that will know what to do with those.
  • Experience views (pages, layouts, views) can include Handlebars helpers for referencing values from a payload you provide to the page’s render context. Those helpers are evaluated server-side.

Is that possible or would I need to serve an Angular project through the Files?

You could serve a single-page, bundled Angular application out of your application files. We do have a React.js Experience Bootstrap template that demonstrates the concepts. I recommend importing that into your application and using that as a starting point for your own Angular app.

Let us know if you have any other questions, and again, welcome to Losant!