Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Chaz Gatian cgatian

🏠
Working from home
Block or report user

Report or block cgatian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View app.component.html
<div *ngFor="let userName of usersName$ | async">
{{ userName }}
</div>
View app.component.ts
import { Component } from '@angular/core';
import { Observable } from 'rxjs';
import { map } from 'rxjs/operators';
import { UsersGQL } from '../generated/types.graphql-gen';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
@cgatian
cgatian / codegen.yml
Last active Sep 6, 2019
GraphQL Code Generator near-operation-file-preset
View codegen.yml
overwrite: true
schema: "schema.graphql"
documents: "src/**/*.graphql"
generates:
src/generated/types.graphql-gen.ts:
plugins:
- "typescript"
src/generated:
preset: near-operation-file
presetConfig:
View app-template-wportal-wdirective.ts
@Component({
selector: 'my-app',
template: `
<ng-template cdkPortal #testTemplate="cdkPortal" let-name>
<div>User {{ name }} </div>
</ng-template>`,
})
export class AppComponent implements OnInit {
@ViewChild('testTemplate') testTemplatePortal: TemplatePortal<any>;
View app-template-wportal.ts
@Component({
selector: 'my-app',
template: `
<ng-template #testTemplate let-name>
<div>User {{ name }} </div>
</ng-template>`,
})
export class AppComponent implements OnInit {
@ViewChild('testTemplate') testTemplate: TemplateRef<any>;
private portalHost: DomPortalHost;
View app-template.component.ts
@Component({
selector: 'my-app',
template: `
<ng-template #testTemplate let-name>
<div>User {{ name }} </div>
</ng-template>`
})
export class AppComponent implements OnInit {
private componentRef;
View portalTemplateDirective.ts
@Component({
selector: 'app-test',
template: `
<ng-content [cdkPortalHost]="_portalInstance"></ng-content>
<ng-template cdkPortal #cartCount>
<div>Hello World</div>
</ng-template>
`
})
export class TestComponent implements OnInit {
View portalHostDirective.ts
@Component({
selector: 'app-test',
template: `
<ng-content [cdkPortalHost]="_portalInstance"></ng-content>
`
})
export class TestComponent implements OnInit {
_portalInstance: Portal<any>;
constructor() { }
@cgatian
cgatian / app.component.ts
Last active Oct 24, 2017
app component using portals
View app.component.ts
import { DomPortalHost, Portal, ComponentPortal } from '@angular/cdk/portal';
@Component({
selector: 'my-app',
template: '',
})
export class AppComponent implements OnInit {
private portalHost: DomPortalHost;
private portal: ComponentPortal<HeaderComponent>;
You can’t perform that action at this time.