Skip to content

Instantly share code, notes, and snippets.

@arturovt
Last active March 17, 2019 21:51
Show Gist options
  • Save arturovt/22c5b46be35fa2c16114586f4e9f9262 to your computer and use it in GitHub Desktop.
Save arturovt/22c5b46be35fa2c16114586f4e9f9262 to your computer and use it in GitHub Desktop.
@Component({
selector: 'app-some-component',
template: `
<ng-template>
<p>Hello world!</p>
</ng-template>
`
})
export class SomeComponent {}
// Скомпилированный шаблон, который находится внутри `ng-template`
export function View_SomeComponent_1() {
return viewDef(
ViewFlags.None,
[
elementDef(
// индекс
0,
NodeFlags.None,
null,
null,
// кол-во дочерних узлов
1,
'p',
[],
null,
null,
null,
null,
null
),
textDef(
// `checkIndex` - индекс шаблонного выражения в массиве, обычно всегда
// значение равняется `-1`, если бы у нас был текст типа
// `Hello {{ name }}!`
// то `checkIndex` равнялся бы `1`, то есть по `0` индексу слово `Hello `,
// по `1` индексу переменная `name`, а по `2` индексу восклицательный знак
-1,
null,
['Hello world!']
)
],
null,
null
);
}
// Скомпилированный шаблон компонента `SomeComponent`
export function View_SomeComponent_0() {
return viewDef(
ViewFlags.None,
[
anchorDef(NodeFlags.None, null, null, 0, null, View_SomeComponent_1)
],
null,
null
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment