@ -11,18 +11,16 @@ import {Component, ContentChild, Directive, Input} from '@angular/core';
|
||||
|
||||
@Directive({selector: 'pane'})
|
||||
export class Pane {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() id !: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'tab',
|
||||
template: `
|
||||
<div>pane: {{pane?.id}}</div>
|
||||
<div>pane: {{pane?.id}}</div>
|
||||
`
|
||||
})
|
||||
export class Tab {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ContentChild(Pane, {static: false}) pane !: Pane;
|
||||
}
|
||||
|
||||
@ -33,7 +31,7 @@ export class Tab {
|
||||
<pane id="1" *ngIf="shouldShow"></pane>
|
||||
<pane id="2" *ngIf="!shouldShow"></pane>
|
||||
</tab>
|
||||
|
||||
|
||||
<button (click)="toggle()">Toggle</button>
|
||||
`,
|
||||
})
|
||||
|
@ -11,14 +11,13 @@ import {Component, ContentChildren, Directive, Input, QueryList} from '@angular/
|
||||
|
||||
@Directive({selector: 'pane'})
|
||||
export class Pane {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() id !: string;
|
||||
}
|
||||
|
||||
@Component({
|
||||
selector: 'tab',
|
||||
template: `
|
||||
<div class="top-level">Top level panes: {{serializedPanes}}</div>
|
||||
<div class="top-level">Top level panes: {{serializedPanes}}</div>
|
||||
<div class="nested">Arbitrary nested panes: {{serializedNestedPanes}}</div>
|
||||
`
|
||||
})
|
||||
@ -47,7 +46,7 @@ export class Tab {
|
||||
</tab>
|
||||
</pane>
|
||||
</tab>
|
||||
|
||||
|
||||
<button (click)="show()">Show 3</button>
|
||||
`,
|
||||
})
|
||||
|
@ -15,7 +15,6 @@ class ChildDirective {
|
||||
|
||||
@Directive({selector: 'someDir'})
|
||||
class SomeDir implements AfterContentInit {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ContentChildren(ChildDirective) contentChildren !: QueryList<ChildDirective>;
|
||||
|
||||
ngAfterContentInit() {
|
||||
|
@ -55,9 +55,7 @@ import {Injectable, InjectionToken, Injector, Optional, ReflectiveInjector} from
|
||||
describe('ClassProvider', () => {
|
||||
it('works', () => {
|
||||
// #docregion ClassProvider
|
||||
abstract class Shape { // TODO(issue/24571): remove '!'.
|
||||
name !: string;
|
||||
}
|
||||
abstract class Shape { name !: string; }
|
||||
|
||||
class Square extends Shape {
|
||||
name = 'square';
|
||||
@ -94,9 +92,7 @@ import {Injectable, InjectionToken, Injector, Optional, ReflectiveInjector} from
|
||||
describe('StaticClassProvider', () => {
|
||||
it('works', () => {
|
||||
// #docregion StaticClassProvider
|
||||
abstract class Shape { // TODO(issue/24571): remove '!'.
|
||||
name !: string;
|
||||
}
|
||||
abstract class Shape { name !: string; }
|
||||
|
||||
class Square extends Shape {
|
||||
name = 'square';
|
||||
|
@ -11,7 +11,6 @@ import {Component, Directive, Input, ViewChild} from '@angular/core';
|
||||
|
||||
@Directive({selector: 'pane'})
|
||||
export class Pane {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() id !: string;
|
||||
}
|
||||
|
||||
@ -20,10 +19,10 @@ export class Pane {
|
||||
template: `
|
||||
<pane id="1" *ngIf="shouldShow"></pane>
|
||||
<pane id="2" *ngIf="!shouldShow"></pane>
|
||||
|
||||
|
||||
<button (click)="toggle()">Toggle</button>
|
||||
|
||||
<div>Selected: {{selectedPane}}</div>
|
||||
|
||||
<div>Selected: {{selectedPane}}</div>
|
||||
`,
|
||||
})
|
||||
export class ViewChildComp {
|
||||
|
@ -15,7 +15,6 @@ class ChildDirective {
|
||||
|
||||
@Component({selector: 'someCmp', templateUrl: 'someCmp.html'})
|
||||
class SomeCmp implements AfterViewInit {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChild(ChildDirective, {static: false}) child !: ChildDirective;
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
@ -11,7 +11,6 @@ import {AfterViewInit, Component, Directive, Input, QueryList, ViewChildren} fro
|
||||
|
||||
@Directive({selector: 'pane'})
|
||||
export class Pane {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@Input() id !: string;
|
||||
}
|
||||
|
||||
@ -21,14 +20,13 @@ export class Pane {
|
||||
<pane id="1"></pane>
|
||||
<pane id="2"></pane>
|
||||
<pane id="3" *ngIf="shouldShow"></pane>
|
||||
|
||||
|
||||
<button (click)="show()">Show 3</button>
|
||||
|
||||
<div>panes: {{serializedPanes}}</div>
|
||||
|
||||
<div>panes: {{serializedPanes}}</div>
|
||||
`,
|
||||
})
|
||||
export class ViewChildrenComp implements AfterViewInit {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChildren(Pane) panes !: QueryList<Pane>;
|
||||
serializedPanes: string = '';
|
||||
|
||||
|
@ -15,7 +15,6 @@ class ChildDirective {
|
||||
|
||||
@Component({selector: 'someCmp', templateUrl: 'someCmp.html'})
|
||||
class SomeCmp implements AfterViewInit {
|
||||
// TODO(issue/24571): remove '!'.
|
||||
@ViewChildren(ChildDirective) viewChildren !: QueryList<ChildDirective>;
|
||||
|
||||
ngAfterViewInit() {
|
||||
|
Reference in New Issue
Block a user