Interfaces

Project

Pages Html

NuGet packageOwin.Framework.Pages.Html
GitHub sourceOwinFramework.Pages.Html

Home |  Readme

[NeedsComponent] attribute | The OWIN Framework Pages

The [NeedsComponent] Attribute

Attach this attribute to a page element to specify that it has a dependency on a non-visual component. The framework will ensure that any page containing the page element will render this non-visual component onto the page.

This attribute is most often used to ensure that the Javascript and CSS assets needed by the page element are rendered into the page.

Note that if many elements on the page depend on the same component, then that component will only be included on the page once.

Example Usage

[IsRegion("address")]
[NeedsComponent("libraries:ajax")]
internal class AddressRegion { }

The [NeedsComponent()] attribute has the following properties you can set.

ComponentName

The name of a component that must be included on any page that includes this page element. If the needed component is in a different package then you need to prefix the component name with the package namespace and a colon. If the needed component is in the same package then the namespace and colon prefix are not required.