I am looking to implement a feature where a custom element is rendered based on a subscription level. In principle I’d like to be able to declare the subscription level that is required for the element to be rendered in the markup, and then have something else decide if the element should be rendered based on the user’s level.
I thought that a Template Controller would be great for this, as I could have it decide if the template should be rendered based on an internal check to see if the user’s subscripion level is sufficient when compared to the passed in parameter, which declares the required level for the element.
Unfortunately, I can’t get passed an error: “you cannot place a template controller on a surrogate element”. I am placing the template controller on the root template of the custom element. I don’t quite understand what is wrong here?
Is there a more idiomatic way in Aurelia to do this? Ideally I would like to declaratively provide a required subscription level for an element, and then have a thing that is in control of rendering make the decision.
Any help appreciated.