id stringlengths 6 6 | text stringlengths 20 17.2k | title stringclasses 1
value |
|---|---|---|
006153 | import {Component} from '@angular/core';
@Component({
selector: 'app-user',
template: `
Username: {{ username }}
`,
standalone: true,
})
export class UserComponent {
username = 'youngTech';
}
@Component({
selector: 'app-root',
template: `
<section>
<app-user />
</section>
`,
standa... | |
006157 | import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
@Component({
selector: 'app-user',
template: `
<p>Username: {{ username }}</p>
<p>Framework: {{ favoriteFramework }}</p>
<label for="framework">
Favorite Framework:
<input id="framework" type="text" [(ngMod... | |
006159 | import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
@Component({
selector: 'app-user',
template: `
<p>Username: {{ username }}</p>
<p>Framework:</p>
<label for="framework">
Favorite Framework:
<input id="framework" type="text" [(ngModel)]="favoriteFramework"... | |
006163 | # Forms Overview
Forms are a big part of many apps because they enable your app to accept user input. Let's learn about how forms are handled in Angular.
In Angular, there are two types of forms: template-driven and reactive. You'll learn about both over the next few activities.
In this activity, you'll learn how to... | |
006165 | import {Component} from '@angular/core';
import {FormsModule} from '@angular/forms';
@Component({
selector: 'app-user',
template: `
<p>Username: {{ username }}</p>
<p>{{ username }}'s favorite framework: {{ favoriteFramework }}</p>
<label for="framework">
Favorite Framework:
<input id="fram... | |
006168 | # Constructor-based dependency injection
In previous activities you used the `inject()` function to make resources available, "providing" them to your components. The `inject()` function is one pattern and it is useful to know that there is another pattern for injecting resources called constructor-based dependency in... | |
006200 | # Defer triggers
While the default options for `@defer` offer great options for lazy loading parts of your components it may still be desirable to further customize the deferred loading experience.
By default, deferred content loads when the browser is idle. You can, however, customize when this loading occurs by spe... | |
006210 | # Angular versioning and releases
We recognize that you need stability from the Angular framework.
Stability ensures that reusable components and libraries, tutorials, tools, and learned practices don't become obsolete unexpectedly.
Stability is essential for the ecosystem around Angular to thrive.
We also share with... | |
006211 | ## Compatibility policy
Angular is a collection of many packages, subprojects, and tools.
To prevent accidental use of private APIs and so that you can clearly understand what is covered by the practices described here — we document what is and is not considered our public API surface.
For details, see [Supported Publ... | |
006214 | ## Unsupported Angular versions
This table covers Angular versions that are no longer under long-term support (LTS). This
information was correct when each version went out of LTS and is provided without any further
guarantees. It is listed here for historical reference.
| Angular | Node.js ... | |
006215 | ## Polyfills
Angular is built on the latest standards of the web platform.
Targeting such a wide range of browsers is challenging because they do not support all features of modern browsers.
You compensate by loading polyfill scripts \("polyfills"\) for the browsers that you must support.
See instructions on how to in... | |
006217 | <docs-decorative-header title="Angular Roadmap" imgSrc="adev/src/assets/images/roadmap.svg"> <!-- markdownlint-disable-line -->
Learn how the Angular team is building momentum on the web.
</docs-decorative-header>
As an open source project, Angular’s daily commits, PRs and momentum is all trackable on GitHub. To incre... | |
006218 | e work, explorations, and prototyping
This section represents explorations and prototyping of potential future projects. A reasonable outcome is to decide that our current solutions are the best options. Other projects may result in RFCs, graduating to in-progress projects, or being deprioritized as the web continues ... | |
006222 | # Migrations
Learn about how you can migrate your existing angular project to the latest features incrementally.
<docs-card-container>
<docs-card title="Standalone" link="Migrate now" href="reference/migrations/standalone">
Standalone components provide a simplified way to build Angular applications. Standalone... | |
006223 | # Migration to the `inject` function
Angular's `inject` function offers more accurate types and better compatibility with standard decorators, compared to constructor-based injection.
This schematic converts constructor-based injection in your classes to use the `inject` function instead.
Run the schematic using the... | |
006224 | # Migration to lazy-loaded routes
This schematic helps developers to convert eagerly loaded component routes to lazy loaded routes. This allows the build process to split the production bundle into smaller chunks, to avoid big JS bundle that includes all routes, which negatively affects initial page load of an applica... | |
006225 | # Migration to Control Flow syntax
[Control flow syntax](guide/templates/control-flow) is available from Angular v17. The new syntax is baked into the template, so you don't need to import `CommonModule` anymore.
This schematic migrates all existing code in your application to use new Control Flow Syntax.
Run the sc... | |
006226 | # Migrate an existing Angular project to standalone
**Standalone components** provide a simplified way to build Angular applications. Standalone components, directives, and pipes aim to streamline the authoring experience by reducing the need for `NgModule`s. Existing applications can optionally and incrementally adop... | |
006232 | ## Configuring CLI builders
Architect is the tool that the Angular CLI uses to perform complex tasks, such as compilation and test running.
Architect is a shell that runs a specified builder to perform a given task, according to a target configuration.
You can define and configure new builders and targets to extend th... | |
006234 | ### Source map configuration
The `sourceMap` builder option can be either a boolean or an object for more fine-tune configuration to control the source maps of an application.
| Options | Details | Value type | Default value |
|:--- |:--- ... | |
006235 | # Workspace and project file structure
You develop applications in the context of an Angular workspace.
A workspace contains the files for one or more projects.
A project is the set of files that comprise an application or a shareable library.
The Angular CLI `ng new` command creates a workspace.
<docs-code language... | |
006250 | # Optional chain not nullable
This diagnostic detects when the left side of an optional chain operation (`.?`) does not include `null` or `undefined` in its type in Angular templates.
<docs-code language="typescript">
import {Component} from '@angular/core';
@Component({
// Print the user's name safely, even if `... | |
006253 | # Missing control flow directive
This diagnostics ensures that a standalone component which uses known control flow directives
(such as `*ngIf`, `*ngFor`, or `*ngSwitch`) in a template, also imports those directives either
individually or by importing the `CommonModule`.
<docs-code language="typescript">
import {Com... | |
006257 | # Track expression resulted in duplicated keys for a given collection.
A track expression specified in the `@for` loop evaluated to duplicated keys for a given collection, ex.:
```typescript
@Component({
template: `@for (item of items; track item.value) {{{item.value}}}`,
})
class TestComponent {
items = [{ke... | |
006270 | # Invalid Element
One or more elements cannot be resolved during compilation because the element is not defined by the HTML spec, or there is no component or directive with such element selector.
HELPFUL: This is the compiler equivalent of a common runtime error `NG0304: '${tagName}' is not a known element: ...`.
##... | |
006273 | # No Provider Found
<docs-video src="https://www.youtube.com/embed/lAlOryf1-WU"/>
You see this error when you try to inject a service but have not declared a corresponding provider. A provider is a mapping that supplies a value that you can inject into the constructor of a class in your application.
Read more on pro... | |
006274 | # Export Not Found
<docs-video src="https://www.youtube.com/embed/fUSAg4kp2WQ"/>
Angular can't find a directive with `{{ PLACEHOLDER }}` export name. The export name is specified in the `exportAs` property of the directive decorator. This is common when using FormsModule or Material modules in templates and you've fo... | |
006275 | # Missing value accessor
For all custom form controls, you must register a value accessor.
Here's an example of how to provide one:
```typescript
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => MyInputField),
multi: true,
}
]
```
## Debugging the error
As described above, y... | |
006277 | # Hydration with unsupported Zone.js instance
This warning means that the hydration was enabled for an application that was configured to use an unsupported version of Zone.js: either a custom or a "noop" one (see more info [here](api/core/BootstrapOptions#ngZone)).
Hydration relies on a signal from Zone.js when it b... | |
006279 | # Missing Reference Target
<docs-video src="https://www.youtube.com/embed/fUSAg4kp2WQ"/>
Angular can't find a directive with `{{ PLACEHOLDER }}` export name.
This is common with a missing import or a missing [`exportAs`](api/core/Directive#exportAs) on a directive.
HELPFUL: This is the compiler equivalent of a commo... | |
006281 | # `inject()` must be called from an injection context
You see this error when you try to use the [`inject`](api/core/inject) function outside of the allowed [injection context](guide/di/dependency-injection-context). The injection context is available during the class creation and initialization. It is also available ... | |
006286 | # Missing Iterable Differ
`NgFor` could not find an iterable differ for the value passed in. Make sure it's an iterable, like an `Array`.
## Debugging the error
When using ngFor in a template, you must use some type of Iterable, like `Array`, `Set`, `Map`, etc.
If you're trying to iterate over the keys in an object,... | |
006288 | # Application remains unstable
This warning only appears in the browser during the hydration process when it's enabled on the client but the application remains unstable for an extended period of time (over 10 seconds).
Typically that happens when there are some pending microtasks or macrotasks on a page.
Angular Hy... | |
006294 | # Tracking expression caused re-creation of the DOM structure.
The identity track expression specified in the `@for` loop caused re-creation of the DOM corresponding to _all_ items. This is a very expensive operation that commonly occurs when working with immutable data structures. For example:
```typescript
@Compone... | |
006305 | ro-list.component.ts" path="adev/src/content/examples/styleguide/src/05-17/app/heroes/hero-list/hero-list.component.ts" visibleRegion="example"/>
### Initialize inputs
#### Style 05-18
TypeScript's `--strictPropertyInitialization` compiler option ensures that a class initializes its properties during construction.
Wh... | |
006307 | # Resolving zone pollution
**Zone.js** is a signaling mechanism that Angular uses to detect when an application state might have changed. It captures asynchronous operations like `setTimeout`, network requests, and event listeners. Angular schedules change detection based on signals from Zone.js.
In some cases schedu... | |
006310 | # Skipping component subtrees
JavaScript, by default, uses mutable data structures that you can reference from multiple different components. Angular runs change detection over your entire component tree to make sure that the most up-to-date state of your data structures is reflected in the DOM.
Change detection is s... | |
006372 | <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 600 445" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" x... | |
006380 | @use 'sass:map';
@use 'external/npm/node_modules/@angular/material/index' as mat;
@include mat.all-component-typographies();
@include mat.core();
html,
body {
padding: 0;
margin: 0;
}
// Light theme
$light-primary: mat.m2-define-palette(mat.$m2-grey-palette, 700, 200);
$light-accent: mat.m2-define-palette(mat.$m2... | |
006467 | /**
* @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} from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './... | |
006471 | /**
* @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 {bootstrapApplication} from '@angular/platform-browser';
import {provideAnimations} from '@angular/platform-b... | |
006486 | /**
* @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} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {MatDialog, MatDialogMod... | |
006491 | /**
* @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 {NgForOf} from '@angular/common';
import {
ChangeDetectorRef,
Component,
EventEmitter,
OnDestroy,
O... | |
006516 | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>ShellChrome</title>
<base href="/" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="icon" type="image/x-icon" href="assets/icon16.png" />
<link rel="stylesheet" href="./third_party/githu... | |
006579 | /**
* @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, inject, input, signal} from '@angular/core';
import {MatOption} from '@angular/material... | |
006885 | /**
* @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, Injectable} from '@angular/core';
import {MatDialog} from '@angular/material/dialog';
import {Di... | |
006897 | /**
* @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 {Pipe, PipeTransform} from '@angular/core';
import {Todo} from './todo';
export const enum TodoFilter {
A... | |
006966 | import {Component} from '@angular/core';
@Component({
template: `
@for (item of items; track item.name[0].toUpperCase()) {
{{item.name}}
}
@for (otherItem of otherItems; track otherItem.name[0].toUpperCase()) {
{{otherItem.name}}
}
`,
standalone: false
})
export class MyApp {
i... | |
006967 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track item; let ev = $even) {
<div (click)="log($index, ev, $first, $count)"></div>
}
</div>
`,
standalone: false
})
export class MyApp {
message = 'hello';
items = [... | |
006972 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track trackFn($index)) {}
</div>
`,
standalone: false
})
export class MyApp {
message = 'hello';
items = [{name: 'one'}, {name: 'two'}, {name: 'three'}];
trackFn(index: number) ... | |
006975 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track item.name[0].toUpperCase()) {
{{item.name}}
}
</div>
`,
standalone: false
})
export class MyApp {
message = 'hello';
items = [{name: 'one'}, {name: 'two'}, {nam... | |
006981 | import {Component, Directive, Input} from '@angular/core';
@Directive({selector: '[binding]'})
export class Binding {
@Input() binding = 0;
}
@Component({
template: `
@for (item of items; track item) {
<div foo="1" bar="2" [binding]="3">{{item}}</div>
} @empty {
<span empty-foo="1" empty-bar="... | |
006982 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track item) {
Index: {{$index}}
First: {{$first}}
Last: {{$last}}
Even: {{$even}}
Odd: {{$odd}}
Count: {{$count}}
}
</div>
`,
stan... | |
006991 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track item) {
{{item.name}}
@for (subitem of item.subItems; track $index) {
{{subitem}} from {{item.name}}
}
}
</div>
`,
standalone: false
})
ex... | |
007004 | type: Component,
args: [{
template: `
<div>
{{message}}
@if (value() === 1) {
one
} @else if (otherValue() === 2) {
two
} @else if (message) {
three
} @else {
four
}
</div>
`,
standalone: fa... | |
007005 | laration<MyApp, "ng-component", never, {}, {}, never, never, false, never>;
}
/****************************************************************************************************
* PARTIAL FILE: if_nested_alias.js
****************************************************************************************************/
... | |
007006 | * PARTIAL FILE: for_track_by_index.js
****************************************************************************************************/
import { Component } from '@angular/core';
import * as i0 from "@angular/core";
export class MyApp {
constructor() {
this.message = 'hello';
this.items = [{ na... | |
007007 | *****************************************************************************************/
import { Component } from '@angular/core';
import * as i0 from "@angular/core";
export class MyApp {
constructor() {
this.message = 'hello';
this.items = [];
}
}
MyApp.ɵfac = i0.ɵɵngDeclareFactory({ minVer... | |
007008 | pe: MyApp, isStandalone: false, selector: "ng-component", ngImport: i0, template: `
<div>
{{message}}
@for (item of items; track item; let ev = $even) {
<div (click)="log($index, ev, $first, $count)"></div>
}
</div>
`, isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.... | |
007010 | rItem.name}}
}
`, isInline: true });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "0.0.0-PLACEHOLDER", ngImport: i0, type: MyApp, decorators: [{
type: Component,
args: [{
template: `
@for (item of items; track trackFn(item, message)) {
{{item.n... | |
007027 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track item) {
{{item.name}}
}
</div>
`,
standalone: false
})
export class MyApp {
message = 'hello';
items = [{name: 'one'}, {name: 'two'}, {name: 'three'}];
} | |
007046 | import {Component} from '@angular/core';
@Component({
template: `
<div>
{{message}}
@for (item of items; track item; let idx = $index, f = $first; let l = $last, ev = $even, o = $odd; let co = $count) {
Original index: {{$index}}
Original first: {{$first}}
Original last: {{$... | |
007047 | import {Component, Directive, Input} from '@angular/core';
@Directive({selector: '[binding]'})
export class Binding {
@Input() binding = 0;
}
@Component({
template: `
@for (item of items; track item) {
<ng-template foo="1" bar="2" [binding]="3">{{item}}</ng-template>
} @empty {
<ng-template em... | |
007062 | import {Component} from '@angular/core';
function it(_desc: string, fn: () => void) {}
it('case 1', () => {
@Component({
template: `
@if (true) {
First
} @else {
Second
}
`,
standalone: false
})
class TestComponent {
}
});
it('case 2', () => {
@Component({
te... | |
007154 | import {Component, Directive, EventEmitter, Input, NgModule, Output} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input bindon-ngModel="name">',
standalone: false
})
export class TestCmp {
name: string = '';
}
@Directive({
selector: '[ngModel]',
standalone: false
})... | |
007161 | import {Component, Directive, EventEmitter, Input, NgModule, Output} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input [(ngModel)]="name">',
standalone: false
})
export class TestCmp {
name: string = '';
}
@Directive({
selector: '[ngModel]',
standalone: false
})
ex... | |
007174 | import {Component} from '@angular/core';
@Component({
template: `
<div i18n>
Content:
@for (item of items; track item) {
before<span>middle</span>after
} @empty {
before<div>empty</div>after
}!
</div>
`,
standalone: false
})
export class MyApp {
items = [1, 2... | |
007386 | import {Injectable, NgModule} from '@angular/core';
@Injectable()
export class Service {
}
@NgModule({providers: [Service]})
export class BaseModule {
constructor(private service: Service) {}
}
@NgModule({})
export class BasicModule extends BaseModule {
} | |
007488 | /****************************************************************************************************
* PARTIAL FILE: root_template.js
****************************************************************************************************/
import { Component, NgModule } from '@angular/core';
import * as i0 from "@angula... | |
007512 | /****************************************************************************************************
* PARTIAL FILE: component.js
****************************************************************************************************/
import { Component } from '@angular/core';
import * as i0 from "@angular/core";
expor... | |
007530 | import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component', template: '<input #user>Hello {{user.value}}!',
standalone: false
})
export class MyComponent {
}
@NgModule({declarations: [MyComponent]})
export class MyModule {
} | |
007540 | nt, deps: [], target: i0.ɵɵFactoryTarget.Component });
MyComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", type: MyComponent, isStandalone: false, selector: "my-component", ngImport: i0, template: `
<ul>
<li *for="let item of items">
<div>{{item.name}}</div>
... | |
007891 | import {Component, Directive, EventEmitter, Input, NgModule, Output} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <ng-template><input [(ngModel)]="name"></ng-template>',
standalone: false
})
export class TestCmp {
name: string = '';
}
@Directive({
selector: '[ngModel]',
... | |
007912 | import {Component, Directive, EventEmitter, Input, NgModule, Output} from '@angular/core';
@Component({
selector: 'test-cmp',
template: 'Name: <input [(ngModel)]="name">',
standalone: false
})
export class TestCmp {
name: string = '';
}
@Directive({
selector: '[ngModel]',
standalone: false
})
ex... | |
007922 | import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component', template: `<div [style.color]></div>`,
standalone: false
})
export class MyComponent {
}
@NgModule({declarations: [MyComponent]})
export class MyModule {
} | |
007961 | import {Component} from '@angular/core';
@Component({
selector: 'my-component',
template: `
<div *ngIf="true" [class.bar]="field"></div>
`
})
export class MyComponent {
field!: any;
} | |
007967 | import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component', template: `<div [class]="myClassExp"></div>`,
standalone: false
})
export class MyComponent {
myClassExp = {'foo': true}
}
@NgModule({declarations: [MyComponent]})
export class MyModule {
} | |
008060 | /****************************************************************************************************
* PARTIAL FILE: safe_keyed_read.js
****************************************************************************************************/
import { Component, NgModule } from '@angular/core';
import * as i0 from "@angu... | |
008061 | LACEHOLDER", ngImport: i0, type: MyApp, deps: [], target: i0.ɵɵFactoryTarget.Component });
MyApp.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", type: MyApp, isStandalone: false, selector: "ng-component", ngImport: i0, template: `
<span>Safe Property with Calls: {{ p()?.a()?.b()?.... | |
008067 | import {Component, NgModule} from '@angular/core';
@Component({
template: `
<span>Safe Property: {{ p?.a?.b?.c?.d }}</span>
<span>Safe Keyed: {{ p?.['a']?.['b']?.['c']?.['d'] }}</span>
<span>Mixed Property: {{ p?.a?.b.c.d?.e?.f?.g.h }}</span>
<span>Mixed Property and Keyed: {{ p.a['b'].c.d?.['e']?.['f']?.g... | |
008110 | import {Component} from '@angular/core';
@Component({
template: `
@for (item of items; track item) {
@let outerFirst = $first;
@for (subitem of item.children; track subitem) {
@let innerFirst = $first;
{{outerFirst || innerFirst}}
}
}
`,
})
export class MyApp {
items: ... | |
008195 | import {Component, NgModule} from '@angular/core';
@Component({
selector: 'my-component', template: '<div></div>',
standalone: false
})
export class MyComponent {
}
@NgModule({declarations: [MyComponent]})
export class MyModule {
} | |
008211 | .0-PLACEHOLDER", ngImport: i0, type: LazyDep, deps: [], target: i0.ɵɵFactoryTarget.Directive });
LazyDep.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "0.0.0-PLACEHOLDER", type: LazyDep, isStandalone: true, selector: "lazy-dep", ngImport: i0 });
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", vers... | |
008212 | <EagerDep, "eager-dep", never, {}, {}, never, never, true, never>;
}
/****************************************************************************************************
* PARTIAL FILE: deferred_with_external_deps_lazy.js
**********************************************************************************************... | |
008214 | ntDeclaration<MyApp, "ng-component", never, {}, {}, never, never, true, never>;
}
/****************************************************************************************************
* PARTIAL FILE: deferred_interaction_same_view_trigger.js
***************************************************************************... | |
008216 | ferredDeps: () => [import("./defer_default_deps_ext").then(m => m.default)], resolveMetadata: CmpA => ({ decorators: [{
type: Component,
args: [{
selector: 'test-cmp',
imports: [CmpA, LocalDep],
template: `
@defer {... | |
008409 | mbol identity', () => {
it('should recompile components when their declaration name changes', () => {
// Testing setup: component Cmp depends on component Dep, which is directly exported.
//
// During the test, Dep's name is changed while keeping its public API the same. The test
/... | |
008424 | compile a standalone component that imports an NgModule', () => {
env.write(
'test.ts',
`
import {Component, Directive, NgModule} from '@angular/core';
@Directive({
selector: '[dir]',
standalone: false,
})
... | |
008462 | ng with the DOM schema', () => {
beforeEach(() => {
env.tsconfig({fullTemplateTypeCheck: false});
});
it('should check for unknown elements', () => {
env.write(
'test.ts',
`
import {Component, NgModule} from '@angular/core';
@Component({
s... | |
008468 | it('should check bindings inside if blocks', () => {
env.write(
'test.ts',
`
import {Component} from '@angular/core';
@Component({
template: \`
@if (expr) {
{{does_not_exist_main}}
} @else if (expr1) {
... | |
008471 | beforeEach(() => {
// `fullTemplateTypeCheck: true` is necessary so content inside `ng-template` is checked.
env.tsconfig({fullTemplateTypeCheck: true});
});
it('should check bindings inside of for loop blocks', () => {
env.write(
'test.ts',
`
import {C... | |
008624 | /**
* @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 {Injectable} from '@angular/core';
@Injectable({
providedIn: 'root',
})
export class Service {} | |
008627 | /**
* @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 {BrowserModule} from '@angular/platform-browser';
import {... | |
009070 | ('for loop blocks', () => {
it('should generate a for block', () => {
const TEMPLATE = `
@for (item of items; track item) {
{{main(item)}}
} @empty {
{{empty()}}
}
`;
const result = tcb(TEMPLATE);
expect(result).toContain('for (const _t1 of ((this... | |
009169 | /**
* @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 {AST, TmplAstNode, TmplAstTemplate} from '@angular/compiler';
import ts from 'typescript';
import {NgCompile... | |
009386 | /**
* @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 'jasmine-ajax';
import {
FetchBackend,
HTTP_INTERCEPTORS,
HttpBackend,
HttpClient,
HttpClientModul... | |
009389 | describe('HttpClient interceptor', () => {
let http: HttpClient;
let interceptors: HttpInterceptor[];
let httpBackend: HttpClientBackendService;
/**
* Test interceptor adds a request header and a response header
*/
@Injectable()
class TestHeaderInterceptor implements HttpInterceptor {... | |
009566 | t('should not emit valueChanges or statusChanges until blur', () => {
const fixture = initTest(FormControlComp);
const control: FormControl = new FormControl('', {
validators: Validators.required,
updateOn: 'blur',
});
fixture.componentInstance.control = control;
... | |
009571 | t('should support rebound controls with rebound validators', () => {
const fixture = initTest(ValidationBindingsForm);
const form = new FormGroup({
'login': new FormControl(''),
'min': new FormControl(''),
'max': new FormControl(''),
'pattern': new FormControl(''),
});
... | |
009578 | 'should cleanup validators on a control used for multiple `formControlName` directives', () => {
const fixture = initTest(NgForFormControlWithValidators, ViewValidatorA, AsyncViewValidatorA);
fixture.detectChanges();
const newControl = new FormControl('b')!;
const oldControl = fixture.component... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.