Skip to content

Instantly share code, notes, and snippets.

View arturovt's full-sized avatar
🎯

Artur arturovt

🎯
View GitHub Profile
<ng-template [ngIf]="authorized">
<ng-container>
<button>Profile</button>
<button>Logout</button>
</ng-container>
</ng-template>
<ng-container *ngIf="authorized">
<button>Profile</button>
<button>Logout</button>
</ng-container>
const comment = document.createComment('');
document.body.appendChild(comment);
const p = document.createElement('p');
const text = document.createTextNode('Hello world!');
p.appendChild(text);
comment.parentNode.insertBefore(p, comment.nextSibling);
{
renderElement: comment, // ссылка на инстанс Comment
componentView: undefined,
viewContainer: null,
template: new TemplateRef_(view, def)
}
{
renderElement: p, // ссылка на инстанс HTMLParagraphElement
componentView: undefined,
viewContainer: null,
template: undefined
}
export interface ElementData {
renderElement: any;
componentView: ViewData;
viewContainer: ViewContainerData | null;
template: TemplateData;
}
@Component({
selector: 'app-some-component',
template: `
<ng-template>
<p>{{ counter }}</p>
</ng-template>
`
})
export class SomeComponent {
public counter = 0;
@Component({
selector: 'app-some-component',
template: `
<ng-tempate>
<p>Hello world!</p>
</ng-tempate>
`
})
export class SomeComponent {}
@Component({
selector: 'app-some-component',
template: `
<ng-template>
<p>Hello world!</p>
</ng-template>
`
})
export class SomeComponent {}
// "256" - это NodeFlags.TypeValueProvider
moduleProviderDef(256, APP_ROOT, true, [])