Holds the data of the model. A fx-model
may have as many fx-instance
elements as
necessary.
Name | Description | default |
---|---|---|
credentials | sets credentials policy - one of ‘omit’, ‘same-origin’ or ‘include’ | same-origin |
id | id of the instance for addressing in refs | default |
shared | boolean attribute to signal that the instance is shared with nested Fore elements | |
src | url to load instance from via http get. This may have static params but cannot use dynamic parameters. See fx-submission for if required. | |
type | ‘xml’ or ‘json’ or ‘html’ are supported by now | xml |
xpath-default-namespace | namespace to be used with unprefixed XPathes | emtpy |
When using multiple instances you must add an id
attribute to each instance that is NOT the first in document order. The first is known as the default instance and doesn’t need an explicit id but can be accessed with instance()
or `instance(‘default’).
You can still however add an id (e.g. ‘myCustomId’) if you like and instance()
or instance('myCustomId')
will return it.
A data structure can be given inline or be loaded via the src
attribute. However there are important limitations of inline instances to be mentioned:
If your require these features you have to create an external XML file and load it with the src
attribute. This gives you a proper XML document.
src
attributeWhen static data files shall be loaded you can use the src
attribute which may also have some static attributes. However, as instance data can
be accessed not before all have been loaded you cannot have dynamic parameters that refer to other nodes.
If that is required you have to use the fx-submission
element and use a ‘get’ request with replace="instance"
to load the data. The submission is then usually fired on model-construct-done
. Examples can be found in the demos.
By adding an shared
attribute to an <fx-instance>
that instance is shared with nested <fx-fore>
elements and can be accessed and mutated as usual.
This can be used if multiple nested Fore elements represent different views but you want to share some common data.
Another possible use case is to separate the model from the UI part and put them in different files for dynamic assembly at runtime (see documentation under ‘modularization’).
In addition to ‘http’, ‘https’ further URI schemes are: