The interpolate
middleware is responsible for dynamic and one-time text interpolation from the state into the HTML view.
- name: interpolate
- middleware dependencies: observe
- all middleware dependencies: observe
- type: content middleware
- ignores: element nodes
- docs
npm install @nx-js/interpolate-middleware
const component = require('@nx-js/core')
const observe = require('@nx-js/observe-middleware')
const interpolate = require('@nx-js/interpolate-middleware')
component()
.useOnContent(observe)
.useOnContent(interpolate)
.register('interpolate-comp')
<interpolate-comp>
<p>${name} is ${age | unit 'year'} old</p>
</interpolate-comp>