How do you use ViewCompiler to manually compile part of the DOM?

后端 未结 2 1066
温柔的废话
温柔的废话 2021-01-07 03:35

Say I have a simple view model (widget.js):

import {Behavior} from \'aurelia-framework\';

export class Widget
{
    static metadata() { return Beha         


        
2条回答
  •  迷失自我
    2021-01-07 03:53

    A few months ago the TemplatingEngine class got a newly accessible enhance API method. This shortcuts the need to manually use the viewCompiler and compile method which was originally the only easy approach. This blog post details how you can use the enhance API to Aureliaify dynamically added HTML in your pages.

    This has the added benefit of not needing to clean up the compiled HTML or detach anything either.

提交回复
热议问题