feat(pipe): added the Pipe decorator and the pipe property to View
BREAKING CHANGE: Instead of configuring pipes via a Pipes object, now you can configure them by providing the pipes property to the View decorator. @Pipe({ name: 'double' }) class DoublePipe { transform(value, args) { return value * 2; } } @View({ template: '{{ 10 | double}}' pipes: [DoublePipe] }) class CustomComponent {} Closes #3572
This commit is contained in:
@ -269,12 +269,11 @@ class _CodegenState {
|
||||
var newValue = _names.getLocalName(r.selfIndex);
|
||||
|
||||
var pipe = _names.getPipeName(r.selfIndex);
|
||||
var cdRef = 'this.ref';
|
||||
var pipeType = r.name;
|
||||
|
||||
var read = '''
|
||||
if ($_IDENTICAL_CHECK_FN($pipe, $_UTIL.uninitialized)) {
|
||||
$pipe = ${_names.getPipesAccessorName()}.get('$pipeType', $cdRef);
|
||||
$pipe = ${_names.getPipesAccessorName()}.get('$pipeType');
|
||||
}
|
||||
$newValue = $pipe.transform($context, [$argString]);
|
||||
''';
|
||||
|
Reference in New Issue
Block a user