AngularJS-2 custom delimiter

I am trying to do something similar to this interpolateProviderin AngularJS 2but cannot find how to do this in a similar way

AngularJS 1.x https://docs.angularjs.org/api/ng/provider/ $ interpolateProvider

$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');

checking documentation for AngularJS 2nothing can find about it. sorry for my English

+4
source share
1 answer

It is available from angular 2.0.0-rc2, if I'm not mistaken, at least in the current rc4. This is no longer a global setting, but a metadata property for each component.

@Component({
    selector: "my-comp",
    templateUrl: "some/url/some-file.html",
    ...,
    interpolation: ["{:!", "!:}"]
})
...

And in the component template, some/url/some-file.htmlyou can use these delimiters:

<div>{:!myExpression!:}</div>

- , , .:)

+2

Source: https://habr.com/ru/post/1627862/


All Articles