id stringlengths 6 6 | text stringlengths 20 17.2k | title stringclasses 1
value |
|---|---|---|
009606 | describe('validator', () => {
it('should run validator with the initial value', () => {
const c = new FormControl('value', Validators.required);
expect(c.valid).toEqual(true);
});
it('should rerun the validator when the value changes', () => {
const c = new FormControl('value'... | |
009610 | describe('valueChanges & statusChanges', () => {
let c: FormControl;
beforeEach(() => {
c = new FormControl('old', Validators.required);
});
it('should fire an event after the value has been updated', (done) => {
c.valueChanges.subscribe({
next: (value: any) => {
... | |
009630 | describe('emit `statusChanges` and `valueChanges` with/without async/sync validators', () => {
const attachEventsLogger = (
control: AbstractControl,
log: string[],
controlName?: string,
) => {
const name = controlName ? ` (${controlName})` : '';
control.statusChanges... | |
009664 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ɵRuntimeError as RuntimeError} from '@angular/core';
import {RuntimeErrorCode} from '../errors';
import {
... | |
009686 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
booleanAttribute,
Directive,
forwardRef,
Input,
OnChanges,
Provider,
SimpleChanges,
} from '@... | |
009687 | /**
* @description
* An interface implemented by classes that perform asynchronous validation.
*
* @usageNotes
*
* ### Provide a custom async validator directive
*
* The following example implements the `AsyncValidator` interface to create an
* async validator directive with a custom error key.
*
* ```typesc... | |
009692 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
Directive,
ElementRef,
forwardRef,
Host,
Input,
OnDestroy,
Optional,
Provider,
Renderer2,... | |
009693 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
export const formControlNameExample = `
<div [formGroup]="myGroup">
<input formControlName="firstName">
</di... | |
009694 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
Directive,
forwardRef,
Host,
Inject,
Input,
OnDestroy,
OnInit,
Optional,
Provider,
Self... | |
009703 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ɵWritable as Writable} from '@angular/core';
import {AsyncValidatorFn, ValidatorFn} from '../directives/val... | |
009704 | s FormGroup<
TControl extends {[K in keyof TControl]: AbstractControl<any>} = any,
> extends AbstractControl<
ɵTypedOrUntyped<TControl, ɵFormGroupValue<TControl>, any>,
ɵTypedOrUntyped<TControl, ɵFormGroupRawValue<TControl>, any>
> {
/**
* Creates a new `FormGroup` instance.
*
* @param controls A colle... | |
009710 | observable that emits an event every time the state of the control changes.
* It emits for value, status, pristine or touched changes.
*
* **Note**: On value change, the emit happens right after a value of this control is updated. The
* value of a parent control (for example if this FormControl is a part of... | |
009713 | or(shouldHaveEmitted: boolean, emitEvent?: boolean): void {
if (this.asyncValidator) {
this.status = PENDING;
this._hasOwnPendingAsyncValidator = {emitEvent: emitEvent !== false};
const obs = toObservable(this.asyncValidator(this));
this._asyncValidationSubscription = obs.subscribe((errors: ... | |
009726 | describe('Angular with zoneless enabled', () => {
async function createFixture<T>(type: Type<T>): Promise<ComponentFixture<T>> {
const fixture = TestBed.createComponent(type);
await fixture.whenStable();
return fixture;
}
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
... | |
009729 | describe('Angular with scheduler and ZoneJS', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [
{provide: ComponentFixtureAutoDetect, useValue: true},
{provide: PLATFORM_ID, useValue: PLATFORM_BROWSER_ID},
],
});
});
it('requires updates inside Angular z... | |
009731 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
ApplicationRef,
ChangeDetectionStrategy,
Component,
effect,
inject,
Injector,
Input,
NgZone... | |
009744 | describe('injection flags', () => {
it('should be able to optionally inject a token', () => {
const TOKEN = new InjectionToken<string>('TOKEN');
expect(TestBed.inject(TOKEN, undefined, {optional: true})).toBeNull();
expect(TestBed.inject(TOKEN, undefined, InjectFlags.Optional)).toBeNull()... | |
009753 | describe('No NgZone', () => {
beforeEach(() => {
TestBed.configureTestingModule({
providers: [{provide: ComponentFixtureNoNgZone, useValue: true}],
});
});
it('calling autoDetectChanges raises an error', () => {
const componentFixture = TestBed.createComponent(SimpleComp);
e... | |
009817 | escribe('projectable nodes', () => {
@Component({
selector: 'test',
template: '',
standalone: false,
})
class TestComponent {
constructor(public vcr: ViewContainerRef) {}
}
@Component({
selector: 'with-content',
template: '',
standalone: false,
})
c... | |
009846 | describe('enforce no new changes', () => {
it('should throw when a record gets changed after it has been checked', fakeAsync(() => {
@Directive({
selector: '[changed]',
standalone: false,
})
class ChangingDirective {
@Input() changed: any;
}
T... | |
009866 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, signal} from '@angular/core';
import {ReactiveNode, setPostSignalSetFn, SIGNAL} from '@angular/cor... | |
009867 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, signal} from '@angular/core';
import {createWatch} from '@angular/core/primitives/signals';
impor... | |
009869 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, signal, untracked} from '@angular/core';
import {flushEffects, resetEffects, testingEffect} from ... | |
009870 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, signal} from '@angular/core';
import {createWatch, ReactiveNode, SIGNAL} from '@angular/core/primi... | |
009871 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {isSignal, linkedSignal, signal, computed} from '@angular/core';
import {testingEffect} from './effect_util';
... | |
009872 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, isSignal, signal} from '@angular/core';
describe('isSignal', () => {
it('should return true for... | |
009881 | nction () {
// these tests are only meant to be run within the DOM (for now)
if (isNode) return;
describe('animation tests', function () {
function getLog(): MockAnimationPlayer[] {
return MockAnimationDriver.log as MockAnimationPlayer[];
}
function resetLog() {
MockAnimationDriver.log =... | |
009897 | ransitions', () => {
@Component({
selector: 'if-cmp',
template: `
<div [@myAnimation]="exp"></div>
`,
animations: [
trigger('myAnimation', [
transition('void => *', [style({opacity: 0}), animate('0.5s 1s', style({opacity: 1}))]),
transiti... | |
009899 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
animate,
animateChild,
AnimationPlayer,
AUTO_STYLE,
group,
query,
sequence,
stagger,
state... | |
009915 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
animate,
animateChild,
group,
query,
sequence,
style,
transition,
trigger,
ɵAnimationGroup... | |
009917 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {animate, query, state, style, transition, trigger} from '@angular/animations';
import {
AnimationDriver,
... | |
009928 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {computed, isSignal, model, WritableSignal} from '@angular/core';
import {TestBed} from '@angular/core/testin... | |
009931 | report unknown property bindings on ng-content', () => {
@Component({
template: `<ng-content *unknownProp="123"></ng-content>`,
standalone: false,
})
class App {}
TestBed.configureTestingModule({declarations: [App]});
const spy = spyOn(console, 'error');
const fixtur... | |
009934 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {CommonModule} from '@angular/common';
import {
ChangeDetectorRef,
Component,
Directive,
EmbeddedView... | |
009936 | describe('before component view', () => {
@Directive({
selector: '[viewInserting]',
exportAs: 'vi',
standalone: false,
})
class ViewInsertingDir {
constructor(private _vcRef: ViewContainerRef) {}
insert(beforeView: ViewRef, insertTpl: TemplateRef<{}>) {
... | |
009938 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {DOCUMENT, NgIf} from '@angular/common';
import {
ApplicationRef,
Component,
ComponentRef,
createComp... | |
009953 | it('should handle nullish coalescing inside templates', () => {
@Component({
template: `
<span [title]="'Your last name is ' + (lastName ?? lastNameFallback ?? 'unknown')">
Hello, {{ firstName ?? 'Frodo' }}!
You are a Balrog: {{ falsyValue ?? true }}
</span>
`,
... | |
009968 | describe('and declaration component is CheckAlways', () => {
beforeEach(() => {
fixture.componentInstance.showCheckAlwaysDeclare = true;
fixture.componentInstance.showOnPushInsert = true;
fixture.detectChanges(false);
viewExecutionLog.length = 0;
});
it('should set up ... | |
010001 | describe('ngOnChanges', () => {
it('should invoke ngOnChanges when an input is set on a host directive', () => {
let firstDirChangeEvent: SimpleChanges | undefined;
let secondDirChangeEvent: SimpleChanges | undefined;
@Directive({standalone: true})
class FirstHostDir implements OnChanges {
... | |
010008 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, Directive} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import {By} from ... | |
010010 | it('should support context for 9+ levels of embedded templates', () => {
@Component({
selector: 'app-multi',
template: `<div *ngFor="let item0 of items">
<span *ngFor="let item1 of item0.data">
<span *ngFor="let item2 of item1.data">
<span *ngFor="let ... | |
010038 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {NgFor} from '@angular/common';
import {
ChangeDetectorRef,
Component,
Directive,
inject,
Input,
... | |
010041 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {NgIf} from '@angular/common';
import {
ChangeDetectorRef,
Component,
Directive,
inject,
Input,
O... | |
010042 | describe('trackBy', () => {
it('should have access to the host context in the track function', () => {
let offsetReads = 0;
@Component({
template: '@for ((item of items); track $index + offset) {{{item}}}',
standalone: false,
})
class TestComponent {
items = ['a', 'b... | |
010043 | describe('list diffing and view operations', () => {
it('should delete views in the middle', () => {
@Component({
template: '@for (item of items; track item; let idx = $index) {{{item}}({{idx}})|}',
standalone: false,
})
class TestComponent {
items = [1, 2, 3];
}
... | |
010045 | it('should not project the root node across multiple layers of @for', () => {
@Component({
standalone: true,
selector: 'test',
template: 'Main: <ng-content/> Slot: <ng-content select="[foo]"/>',
})
class TestComponent {}
@Component({
standalone: true,
imp... | |
010046 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {CommonModule} from '@angular/common';
import {
AfterViewInit,
ChangeDetectorRef,
Component,
ContentC... | |
010049 | it('should call onChanges properly in for loop with children', () => {
const events: any[] = [];
@Component({
selector: 'child',
template: `<p>{{val}}</p>`,
standalone: false,
})
class Child {
@Input() val = '';
@Input() name = '';
ngOnChanges(changes: SimpleChange... | |
010113 | scribe('OnPush', () => {
@Component({
selector: 'my-comp',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `{{ doCheckCount }} - {{ name }} <button (click)="onClick()"></button>`,
standalone: false,
})
class MyComponent implements DoCheck {
@Input() name = 'Nancy';
... | |
010114 | scribe('ChangeDetectorRef', () => {
describe('detectChanges()', () => {
@Component({
selector: 'my-comp',
template: '{{ name }}',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
})
class MyComp implements DoCheck {
doCheckCount = 0;
... | |
010115 | ('should support change detection triggered as a result of View queries processing', () => {
@Component({
selector: 'app',
template: `
<div *ngIf="visible" #ref>Visible text</div>
`,
standalone: false,
})
class App {
@ViewChildren('re... | |
010116 | scribe('markForCheck()', () => {
@Component({
selector: 'on-push-comp',
template: '{{ value }}',
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: false,
})
class OnPushComp implements DoCheck {
value = 'one';
doCheckCount = 0;
const... | |
010134 | intersection observer once all deferred blocks have been loaded', fakeAsync(() => {
@Component({
standalone: true,
template: `
<button #triggerOne></button>
@defer (on viewport(triggerOne)) {
One
}
<button #triggerTwo></button>
... | |
010145 | ('should create the root node in the correct namespace when previous node is SVG', () => {
@Component({
template: `
<div>Some random content</div>
<!-- Note that it's important for the test that the <svg> element is last. -->
<svg></svg>
`,
standalone: false,
... | |
010151 | scribe('root view container ref', () => {
let containerEl: HTMLElement | null = null;
beforeEach(() => (containerEl = null));
/**
* Creates a new test component renderer instance that wraps the root element
* in another element. This allows us to test if elements have been inserted into
* t... | |
010184 | describe('afterNextRender', () => {
it('should run with the correct timing', () => {
@Component({
selector: 'dynamic-comp',
standalone: false,
})
class DynamicComp {
afterRenderCount = 0;
constructor() {
afterNextRender(() => {
... | |
010186 | it('should destroy after the hook has run', () => {
let hookRef: AfterRenderRef | null = null;
let afterRenderCount = 0;
@Component({selector: 'comp', standalone: false})
class Comp {
constructor() {
hookRef = afterNextRender(() => {
afterRenderCount++;
}... | |
010195 | () => {
function getElementHtml(element: HTMLElement) {
return element.innerHTML
.replace(/<!--(\W|\w)*?-->/g, '')
.replace(/\sng-reflect-\S*="[^"]*"/g, '');
}
it('should project content', () => {
@Component({
selector: 'child',
template: `<div><ng-content></ng-content></div>`,
... | |
010196 | it('should project into dynamic views with specific selectors', () => {
@Component({
selector: 'child',
template: `
<ng-content></ng-content>
Before-
<ng-template [ngIf]="showing">
<ng-content select="div"></ng-content>
</ng-template>
-After`,
stan... | |
010198 | describe('with selectors', () => {
it('should project nodes using attribute selectors', () => {
@Component({
selector: 'child',
template: `<div id="first"><ng-content select="span[title=toFirst]"></ng-content></div>
<div id="second"><ng-content select="span[title=toSecond]"></ng-cont... | |
010199 | it('should project nodes where attribute selector matches a binding', () => {
@Component({
selector: 'child',
template: `<ng-content select="[title]"></ng-content>`,
standalone: false,
})
class Child {}
@Component({
selector: 'parent',
template: `<child><... | |
010203 | it('should render the fallback content if content is not provided through projectableNodes', () => {
@Component({
standalone: true,
template:
`<ng-content>One fallback</ng-content>|` +
`<ng-content>Two fallback</ng-content>|<ng-content>Three fallback</ng-content>`,
})
... | |
010242 | describe('OnPush components with signals', () => {
it('marks view dirty', () => {
@Component({
template: `{{value()}}{{incrementTemplateExecutions()}}`,
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
class OnPushCmp {
numTemplateExecutions = 0;
value = ... | |
010243 | it('can have signals in both template and host bindings', () => {
@Component({
template: ``,
selector: 'child',
host: {'[class.blue]': 'useBlue()'},
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
})
class ChildCmp {
useBlue = signal(false);
}
... | |
010264 | ('attribute tokens', () => {
it('should be able to provide an attribute token', () => {
const TOKEN = new InjectionToken<string>('Some token');
function factory(token: string): string {
return token + ' with factory';
}
@Component({
selector: 'my-comp',
template: '...... | |
010287 | /*!
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
Component,
Directive,
effect,
ErrorHandler,
EventEmitter,
output,
signal,
} from '@angular/co... | |
010288 | describe('outputFromObservable()', () => {
it('should support using a `Subject` as source', () => {
@Directive({
selector: '[dir]',
standalone: true,
})
class Dir {
onBla$ = new Subject<number>();
onBla = outputFromObservable(this.onBla$);
}
@Component(... | |
010316 | describe('reactivity', () => {
let prev: boolean;
beforeEach(() => {
prev = setUseMicrotaskEffectsByDefault(false);
});
afterEach(() => setUseMicrotaskEffectsByDefault(prev));
describe('effects', () => {
beforeEach(destroyPlatform);
afterEach(destroyPlatform);
it(
'should run effects i... | |
010317 | it('should check views made dirty from markForCheck() from an effect in a directive', async () => {
TestBed.configureTestingModule({
providers: [provideExperimentalZonelessChangeDetection()],
});
const source = signal('');
@Directive({
standalone: true,
selector: '[dir]... | |
010318 | describe('safeguards', () => {
it('should allow writing to signals within effects', () => {
const counter = signal(0);
effect(() => counter.set(1), {injector: TestBed.inject(Injector)});
TestBed.flushEffects();
expect(counter()).toBe(1);
});
it('should allow writing to signals in n... | |
010414 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {ChangeDetectorRef, Component, Injectable, NgModule, ViewEncapsulation} from '@angular/core';
import {loadTra... | |
010443 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, NgModule} from '@angular/core';
import {
FormArray,
FormBuilder,
FormControl,
FormGroup,
... | |
010497 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {Component, NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {BrowserModule,... | |
010501 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {animate, style, transition, trigger} from '@angular/animations';
import {Component, NgModule, ɵNgModuleFactor... | |
010505 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {animate, style, transition, trigger} from '@angular/animations';
import {Component, NgModule, ɵNgModuleFactor... | |
010509 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {APP_BASE_HREF} from '@angular/common';
import {Component, OnInit} from '@angular/core';
import {bootstrapApp... | |
010533 | # Angular Signals Implementation
This directory contains the code which powers Angular's reactive primitive, an implementation of the "signal" concept. A signal is a value which is "reactive", meaning it can notify interested consumers when it changes. There are many different implementations of this concept, with dif... | |
010534 | Glitch Free" property
Consider the following setup:
```typescript
const counter = signal(0);
const evenOrOdd = computed(() => counter() % 2 === 0 ? 'even' : 'odd');
effect(() => console.log(counter() + ' is ' + evenOrOdd()));
counter.set(1);
```
When the effect is first created, it will print "0 is even", as expect... | |
010539 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/**
* A comparison function which can determine if two values are equal.
*/
export type ValueEqualityFn<T> = (a: T... | |
010544 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {defaultEquals, ValueEqualityFn} from './equality';
import {throwInvalidWriteToSignalError} from './errors';
... | |
010622 | <T>(type: Type<T>): ComponentFixture<T> {
const testComponentRenderer = this.inject(TestComponentRenderer);
const rootElId = `root${_nextRootElementId++}`;
testComponentRenderer.insertRootElement(rootElId);
if (getAsyncClassMetadataFn(type)) {
throw new Error(
`Component '${type.name}' ha... | |
010636 | describe('toSignal()', () => {
it(
'should reflect the last emitted value of an Observable',
test(() => {
const counter$ = new BehaviorSubject(0);
const counter = toSignal(counter$);
expect(counter()).toBe(0);
counter$.next(1);
expect(counter()).toBe(1);
counter$.next(3);
... | |
010639 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
Component,
computed,
createEnvironmentInjector,
EnvironmentInjector,
Injector,
Signal,
signal... | |
010647 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
assertInInjectionContext,
DestroyRef,
effect,
inject,
Injector,
Signal,
untracked,
ɵmicrota... | |
010648 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
assertInInjectionContext,
assertNotInReactiveContext,
computed,
DestroyRef,
inject,
Injector,
... | |
010649 | port function toSignal<T, U = undefined>(
source: Observable<T> | Subscribable<T>,
options?: ToSignalOptions<T | U> & {initialValue?: U},
): Signal<T | U> {
ngDevMode &&
assertNotInReactiveContext(
toSignal,
'Invoking `toSignal` causes new subscriptions every time. ' +
'Consider moving `to... | |
010697 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// tslint:disable
import {Component, Input} from '@angular/core';
@Component({
template: `
{{bla?.myInput}}
... | |
010868 | s imports to the `imports` in a test', async () => {
writeFile(
'app.spec.ts',
`
import {NgModule, Component} from '@angular/core';
import {TestBed} from '@angular/core/testing';
import {MatCardModule} from '@angular/material/card';
describe('bootstrapping an app', () => {
... | |
010874 | .bootstrapModule call to bootstrapApplication', async () => {
writeFile(
'main.ts',
`
import {AppModule} from './app/app.module';
import {platformBrowser} from '@angular/platform-browser';
platformBrowser().bootstrapModule(AppModule).catch(e => console.error(e));
`,
);
wr... | |
010876 | orts` array to the `providers` and wrap them in `importProvidersFrom`', async () => {
writeFile(
'main.ts',
`
import {AppModule} from './app/app.module';
import {platformBrowser} from '@angular/platform-browser';
platformBrowser().bootstrapModule(AppModule).catch(e => console.er... | |
010877 | th `initialNavigation: "enabledBlocking"` to withEnabledBlockingInitialNavigation', async () => {
writeFile(
'main.ts',
`
import {AppModule} from './app/app.module';
import {platformBrowser} from '@angular/platform-browser';
platformBrowser().bootstrapModule(AppModule).cat... | |
010878 | t map to a feature into withRouterConfig', async () => {
writeFile(
'main.ts',
`
import {AppModule} from './app/app.module';
import {platformBrowser} from '@angular/platform-browser';
platformBrowser().bootstrapModule(AppModule).catch(e => console.error(e));
`,
);
writeFi... | |
010884 | it('should migrate nested children components', async () => {
writeFile(
'app.module.ts',
`
import {NgModule} from '@angular/core';
import {RouterModule} from '@angular/router';
import {routes} from './routes';
@NgModule({ imports: [RouterModule.forRoot(routes] })
export cl... | |
010887 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import {getSystemPath, normalize, virtualFs} from '@angular-devkit/core';
import {TempScopedNodeJsSyncHost} from '@an... | |
010888 | /**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {getSystemPath, logging, normalize, virtualFs} from '@angular-devkit/core';
import {TempScopedNodeJsSyncHost}... | |
010889 | describe('ngIf', () => {
it('should migrate an inline template', async () => {
writeFile(
'/comp.ts',
`
import {Component} from '@angular/core';
import {NgIf} from '@angular/common';
@Component({
imports: [NgIf],
template: \`<div><span *ngIf="toggle... | |
010890 | it('should migrate an if then else case as bindings', async () => {
writeFile(
'/comp.ts',
`
import {Component} from '@angular/core';
import {NgIf,NgIfElse} from '@angular/common';
@Component({
templateUrl: './comp.html'
})
class Comp {
... | |
010891 | it('should migrate an if case with an ng-container with empty i18n', async () => {
writeFile(
'/comp.ts',
`
import {Component} from '@angular/core';
import {NgIf} from '@angular/common';
@Component({
templateUrl: './comp.html'
})
class Comp {
... | |
010892 | it('should migrate an if then else case with no semicolons', async () => {
writeFile(
'/comp.ts',
`
import {Component} from '@angular/core';
import {NgIf} from '@angular/common';
@Component({
templateUrl: './comp.html'
})
class Comp {
sh... | |
010893 | it('should migrate a complex if then else case on ng-containers', async () => {
writeFile(
'/comp.ts',
`
import {Component} from '@angular/core';
import {NgIf} from '@angular/common';
@Component({
templateUrl: './comp.html'
})
class Comp {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.