_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
angular/adev/src/content/examples/form-validation/src/app/template/actor-form-template.component.ts_0_411
import {Component} from '@angular/core'; @Component({ selector: 'app-actor-form-template', templateUrl: './actor-form-template.component.html', styleUrls: ['./actor-form-template.component.css'], standalone: false, }) export class ActorFormTemplateComponent { skills = ['Method Acting', 'Singing', 'Dancing', ...
{ "end_byte": 411, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/template/actor-form-template.component.ts" }
angular/adev/src/content/examples/form-validation/src/app/template/actor-form-template.component.css_0_85
/* #docregion */ .cross-validation-error input { border-left: 5px solid #a94442; }
{ "end_byte": 85, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/template/actor-form-template.component.css" }
angular/adev/src/content/examples/form-validation/src/app/shared/unambiguous-role.ts_0_1044
// #docregion import {Directive} from '@angular/core'; import { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn, } from '@angular/forms'; // #docregion cross-validation-validator /** An actor's name can't match the actor's role */ export const unambiguousRoleValidator: ValidatorFn = ...
{ "end_byte": 1044, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/shared/unambiguous-role.ts" }
angular/adev/src/content/examples/form-validation/src/app/shared/unambiguous-role.directive.ts_0_1043
// #docregion import {Directive} from '@angular/core'; import { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn, } from '@angular/forms'; // #docregion cross-validation-validator /** An actor's name can't match the actor's role */ export const unambiguousRoleValidator: ValidatorFn = ...
{ "end_byte": 1043, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/shared/unambiguous-role.directive.ts" }
angular/adev/src/content/examples/form-validation/src/app/shared/forbidden-name.directive.ts_0_1134
// #docregion import {Directive, Input} from '@angular/core'; import { AbstractControl, NG_VALIDATORS, ValidationErrors, Validator, ValidatorFn, } from '@angular/forms'; // #docregion custom-validator /** An actor's name can't match the given regular expression */ export function forbiddenNameValidator(nameR...
{ "end_byte": 1134, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/shared/forbidden-name.directive.ts" }
angular/adev/src/content/examples/form-validation/src/app/shared/actors.service.ts_0_379
import {Injectable} from '@angular/core'; import {Observable, of} from 'rxjs'; import {delay} from 'rxjs/operators'; const ROLES = ['Hamlet', 'Ophelia', 'Romeo', 'Juliet']; @Injectable({providedIn: 'root'}) export class ActorsService { isRoleTaken(role: string): Observable<boolean> { const isTaken = ROLES.inclu...
{ "end_byte": 379, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/shared/actors.service.ts" }
angular/adev/src/content/examples/form-validation/src/app/shared/role.directive.ts_0_1338
import {Directive, forwardRef, Injectable} from '@angular/core'; import { AsyncValidator, AbstractControl, NG_ASYNC_VALIDATORS, ValidationErrors, } from '@angular/forms'; import {catchError, map} from 'rxjs/operators'; import {ActorsService} from './actors.service'; import {Observable, of} from 'rxjs'; // #doc...
{ "end_byte": 1338, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/app/shared/role.directive.ts" }
angular/adev/src/content/examples/form-validation/src/assets/forms.css_1_405
.ng-valid[required], .ng-valid.required { border-left: 5px solid #42A948; /* green */ } .ng-invalid:not(form) { border-left: 5px solid #a94442; /* red */ } .alert div { background-color: #fed3d3; color: #820000; padding: 1rem; margin-bottom: 1rem; } .form-group { margin-bottom: 1rem; } label { dis...
{ "end_byte": 405, "start_byte": 1, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/form-validation/src/assets/forms.css" }
angular/adev/src/content/examples/inputs-outputs/BUILD.bazel_0_54
package(default_visibility = ["//visibility:public"])
{ "end_byte": 54, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/BUILD.bazel" }
angular/adev/src/content/examples/inputs-outputs/e2e/src/app.e2e-spec.ts_0_2103
import {browser, element, by, logging, ExpectedConditions as EC} from 'protractor'; describe('Inputs and Outputs', () => { beforeEach(() => browser.get('')); // helper function used to test what's logged to the console async function logChecker(contents: string) { const logs = await browser.manage().logs()....
{ "end_byte": 2103, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/e2e/src/app.e2e-spec.ts" }
angular/adev/src/content/examples/inputs-outputs/src/index.html_0_304
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Inputs and Outputs</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 304, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/index.html" }
angular/adev/src/content/examples/inputs-outputs/src/main.ts_0_278
import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, { providers: [ provideProtractorTestingSupport(), // essential for e2e testing ], });
{ "end_byte": 278, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/main.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/app.component.html_0_1601
<h1>Inputs and Outputs</h1> <!-- #docregion input-parent --> <app-item-detail [item]="currentItem"></app-item-detail> <!-- #enddocregion input-parent --> <!-- #docregion input-parent-metadata --> <app-item-detail-metadata [item]="currentItem" [itemAvailability]="true"></app-item-detail-metadata> <!-- #enddocregion in...
{ "end_byte": 1601, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/app.component.html" }
angular/adev/src/content/examples/inputs-outputs/src/app/item-detail.component.html_0_169
<h2>Child component with &commat;Input()</h2> <!-- #docregion property-in-template --> <p> Today's item: {{ item }} </p> <!-- #enddocregion property-in-template -->
{ "end_byte": 169, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/item-detail.component.html" }
angular/adev/src/content/examples/inputs-outputs/src/app/item-details-metadata.component.ts_0_1074
// #docplaster // #docregion use-input-metadata-required import {Component, Input} from '@angular/core'; // First, import Input // #enddocregion use-input-metadata-required // #docregion use-input-metadata-boolean-transform import {booleanAttribute} from '@angular/core'; // First, import booleanAttribute // #enddocregi...
{ "end_byte": 1074, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/item-details-metadata.component.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/in-the-metadata.component.ts_0_677
/* eslint-disable @angular-eslint/no-inputs-metadata-property, @angular-eslint/no-outputs-metadata-property */ import {Component, EventEmitter} from '@angular/core'; @Component({ standalone: true, selector: 'app-in-the-metadata', template: ` <p>Latest clearance item: {{clearanceItem}}</p> <button type="butt...
{ "end_byte": 677, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/in-the-metadata.component.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/item-output.component.html_0_295
<h2>Child component with &commat;Output()</h2> <!-- #docregion child-output --> <label for="item-input">Add an item:</label> <input type="text" id="item-input" #newItem> <button type="button" (click)="addNewItem(newItem.value)">Add to parent's list</button> <!-- #enddocregion child-output -->
{ "end_byte": 295, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/item-output.component.html" }
angular/adev/src/content/examples/inputs-outputs/src/app/app.component.ts_0_1841
// #docplaster import {Component} from '@angular/core'; import {NgFor} from '@angular/common'; import {AliasingComponent} from './aliasing.component'; import {InputOutputComponent} from './input-output.component'; import {InTheMetadataComponent} from './in-the-metadata.component'; import {ItemDetailComponent} from './...
{ "end_byte": 1841, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/app.component.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/item-output.component.ts_0_467
import {Component, Output, EventEmitter} from '@angular/core'; @Component({ standalone: true, selector: 'app-item-output', templateUrl: './item-output.component.html', }) // #docregion item-output-class export class ItemOutputComponent { // #docregion item-output @Output() newItemEvent = new EventEmitter<st...
{ "end_byte": 467, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/item-output.component.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/aliasing.component.ts_0_1265
/* eslint-disable @angular-eslint/no-input-rename, @angular-eslint/no-inputs-metadata-property, @angular-eslint/no-output-rename, @angular-eslint/no-outputs-metadata-property */ import {Component, EventEmitter, Input, Output} from '@angular/core'; @Component({ st...
{ "end_byte": 1265, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/aliasing.component.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/input-output.component.ts_0_635
import {Component, Input, Output, EventEmitter} from '@angular/core'; @Component({ standalone: true, selector: 'app-input-output', template: ` <p [style.text-decoration]="lineThrough">Item: {{item}}</p> <button type="button" (click)="delete()">Delete item with an Output!</button> `, }) export class InputOu...
{ "end_byte": 635, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/input-output.component.ts" }
angular/adev/src/content/examples/inputs-outputs/src/app/item-detail.component.ts_0_402
// #docplaster // #docregion use-input import {Component, Input} from '@angular/core'; // First, import Input // #enddocregion use-input @Component({ standalone: true, selector: 'app-item-detail', templateUrl: './item-detail.component.html', }) // #docregion use-input export class ItemDetailComponent { @Input...
{ "end_byte": 402, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/inputs-outputs/src/app/item-detail.component.ts" }
angular/adev/src/content/examples/angular-linker-plugin/webpack.config.mjs_0_560
// #docplaster ... // #docregion webpack-config import linkerPlugin from '@angular/compiler-cli/linker/babel'; export default { // #enddocregion webpack-config // #docregion webpack-config module: { rules: [ { test: /\.m?js$/, use: { loader: 'babel-loader', options: ...
{ "end_byte": 560, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/angular-linker-plugin/webpack.config.mjs" }
angular/adev/src/content/examples/angular-linker-plugin/BUILD.bazel_0_27
exports_files(glob(["*"]))
{ "end_byte": 27, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/angular-linker-plugin/BUILD.bazel" }
angular/adev/src/content/examples/setup/non-essential-files.txt_0_164
.git .gitignore .travis.yml *.spec*.ts CHANGELOG.md e2e favicon.ico karma.conf.js karma-test-shim.js LICENSE non-essential-files.txt protractor.config.js README.md
{ "end_byte": 164, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/non-essential-files.txt" }
angular/adev/src/content/examples/setup/BUILD.bazel_0_54
package(default_visibility = ["//visibility:public"])
{ "end_byte": 54, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/BUILD.bazel" }
angular/adev/src/content/examples/setup/e2e/src/app.e2e-spec.ts_0_304
import {browser, element, by} from 'protractor'; describe('QuickStart E2E Tests', () => { const expectedMsg = 'Hello Angular'; beforeEach(() => browser.get('')); it(`should display: ${expectedMsg}`, async () => { expect(await element(by.css('h1')).getText()).toEqual(expectedMsg); }); });
{ "end_byte": 304, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/e2e/src/app.e2e-spec.ts" }
angular/adev/src/content/examples/setup/src/index.html_0_732
<!DOCTYPE html> <html lang="en"> <head> <title>Angular Quickstart Seed</title> <base href="/"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="styles.css"> <!-- Polyfills --> <script src="node_modules/core-js/client/...
{ "end_byte": 732, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/src/index.html" }
angular/adev/src/content/examples/setup/src/main.ts_0_228
// #docregion import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {AppModule} from './app/app.module'; platformBrowserDynamic() .bootstrapModule(AppModule) .catch((err) => console.error(err));
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/src/main.ts" }
angular/adev/src/content/examples/setup/src/systemjs.config.extras.js_0_209
/** * Add barrels and stuff * Adjust as necessary for your application needs. */ // (function (global) { // System.config({ // packages: { // // add packages here // } // }); // })(this);
{ "end_byte": 209, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/src/systemjs.config.extras.js" }
angular/adev/src/content/examples/setup/src/app/app.component.spec.ts_0_928
import {DebugElement} from '@angular/core'; import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; import {AppComponent} from './app.component'; describe('AppComponent', () => { let de: DebugElement; let comp: AppComponent; let fixture: Compo...
{ "end_byte": 928, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/src/app/app.component.spec.ts" }
angular/adev/src/content/examples/setup/src/app/app.module.ts_0_288
// #docregion import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {AppComponent} from './app.component'; @NgModule({ imports: [BrowserModule], declarations: [AppComponent], bootstrap: [AppComponent], }) export class AppModule {}
{ "end_byte": 288, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/src/app/app.module.ts" }
angular/adev/src/content/examples/setup/src/app/app.component.ts_0_206
// #docregion import {Component} from '@angular/core'; @Component({ selector: 'app-root', template: '<h1>Hello {{name}}</h1>', standalone: false, }) export class AppComponent { name = 'Angular'; }
{ "end_byte": 206, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/setup/src/app/app.component.ts" }
angular/adev/src/content/examples/forms-overview/BUILD.bazel_0_352
package(default_visibility = ["//visibility:public"]) exports_files([ "src/app/reactive/favorite-color/favorite-color.component.spec.ts", "src/app/reactive/favorite-color/favorite-color.component.ts", "src/app/template/favorite-color/favorite-color.component.spec.ts", "src/app/template/favorite-color/f...
{ "end_byte": 352, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/BUILD.bazel" }
angular/adev/src/content/examples/forms-overview/e2e/src/app.e2e-spec.ts_0_299
import {AppPage} from './app.po'; describe('forms-overview App', () => { let page: AppPage; beforeEach(() => { page = new AppPage(); }); it('should display a title', async () => { await page.navigateTo(); expect(await page.getTitleText()).toEqual('Forms Overview'); }); });
{ "end_byte": 299, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/e2e/src/app.e2e-spec.ts" }
angular/adev/src/content/examples/forms-overview/src/index.html_0_300
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Forms Overview</title> <base href="/"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="icon" type="image/x-icon" href="favicon.ico"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 300, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/index.html" }
angular/adev/src/content/examples/forms-overview/src/main.ts_0_214
import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {AppModule} from './app/app.module'; platformBrowserDynamic() .bootstrapModule(AppModule) .catch((err) => console.error(err));
{ "end_byte": 214, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/main.ts" }
angular/adev/src/content/examples/forms-overview/src/app/app.component.html_0_258
<!--The content below is only a placeholder and can be replaced.--> <h1>Forms Overview</h1> <h2>Reactive</h2> <app-reactive-favorite-color></app-reactive-favorite-color> <h2>Template-Driven</h2> <app-template-favorite-color></app-template-favorite-color>
{ "end_byte": 258, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/app.component.html" }
angular/adev/src/content/examples/forms-overview/src/app/app.component.spec.ts_0_935
import {TestBed, waitForAsync} from '@angular/core/testing'; import {AppComponent} from './app.component'; import {ReactiveModule} from './reactive/reactive.module'; import {TemplateModule} from './template/template.module'; describe('AppComponent', () => { beforeEach(waitForAsync(() => { TestBed.configureTesti...
{ "end_byte": 935, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/app.component.spec.ts" }
angular/adev/src/content/examples/forms-overview/src/app/app.module.ts_0_425
import {BrowserModule} from '@angular/platform-browser'; import {NgModule} from '@angular/core'; import {AppComponent} from './app.component'; import {ReactiveModule} from './reactive/reactive.module'; import {TemplateModule} from './template/template.module'; @NgModule({ declarations: [AppComponent], imports: [B...
{ "end_byte": 425, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/app.module.ts" }
angular/adev/src/content/examples/forms-overview/src/app/app.component.ts_0_235
import {Component} from '@angular/core'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.css'], standalone: false, }) export class AppComponent { title = 'forms-intro'; }
{ "end_byte": 235, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/app.component.ts" }
angular/adev/src/content/examples/forms-overview/src/app/reactive/reactive.module.ts_0_394
import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {ReactiveFormsModule} from '@angular/forms'; import {FavoriteColorComponent} from './favorite-color/favorite-color.component'; @NgModule({ imports: [CommonModule, ReactiveFormsModule], declarations: [FavoriteColorComponent...
{ "end_byte": 394, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/reactive/reactive.module.ts" }
angular/adev/src/content/examples/forms-overview/src/app/reactive/favorite-color/favorite-color.component.ts_0_348
import {Component} from '@angular/core'; import {FormControl} from '@angular/forms'; @Component({ selector: 'app-reactive-favorite-color', template: ` Favorite Color: <input type="text" [formControl]="favoriteColorControl"> `, standalone: false, }) export class FavoriteColorComponent { favoriteColorContr...
{ "end_byte": 348, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/reactive/favorite-color/favorite-color.component.ts" }
angular/adev/src/content/examples/forms-overview/src/app/reactive/favorite-color/favorite-color.component.spec.ts_0_1483
import {ComponentFixture, TestBed, waitForAsync} from '@angular/core/testing'; import {ReactiveFormsModule} from '@angular/forms'; import {createNewEvent} from '../../shared/utils'; import {FavoriteColorComponent} from './favorite-color.component'; describe('Favorite Color Component', () => { let component: Favorit...
{ "end_byte": 1483, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/reactive/favorite-color/favorite-color.component.spec.ts" }
angular/adev/src/content/examples/forms-overview/src/app/template/template.module.ts_0_378
import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {FavoriteColorComponent} from './favorite-color/favorite-color.component'; @NgModule({ imports: [CommonModule, FormsModule], declarations: [FavoriteColorComponent], exports: [F...
{ "end_byte": 378, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/template/template.module.ts" }
angular/adev/src/content/examples/forms-overview/src/app/template/favorite-color/favorite-color.component.ts_0_271
import {Component} from '@angular/core'; @Component({ selector: 'app-template-favorite-color', template: ` Favorite Color: <input type="text" [(ngModel)]="favoriteColor"> `, standalone: false, }) export class FavoriteColorComponent { favoriteColor = ''; }
{ "end_byte": 271, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/template/favorite-color/favorite-color.component.ts" }
angular/adev/src/content/examples/forms-overview/src/app/template/favorite-color/favorite-color.component.spec.ts_0_1553
import {ComponentFixture, fakeAsync, TestBed, tick, waitForAsync} from '@angular/core/testing'; import {FormsModule} from '@angular/forms'; import {createNewEvent} from '../../shared/utils'; import {FavoriteColorComponent} from './favorite-color.component'; describe('FavoriteColorComponent', () => { let component: ...
{ "end_byte": 1553, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/template/favorite-color/favorite-color.component.spec.ts" }
angular/adev/src/content/examples/forms-overview/src/app/shared/utils.ts_0_217
export function createNewEvent(eventName: string, bubbles = false, cancelable = false) { const evt = document.createEvent('CustomEvent'); evt.initCustomEvent(eventName, bubbles, cancelable, null); return evt; }
{ "end_byte": 217, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/forms-overview/src/app/shared/utils.ts" }
angular/adev/src/content/examples/pipes/BUILD.bazel_0_381
package(default_visibility = ["//visibility:public"]) exports_files([ "src/app/exponential-strength.pipe.ts", "src/app/flying-heroes.component.html", "src/app/flying-heroes.component.ts", "src/app/flying-heroes.pipe.ts", "src/app/flying-heroes-impure.component.html", "src/app/hero-async-message...
{ "end_byte": 381, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/BUILD.bazel" }
angular/adev/src/content/examples/pipes/e2e/src/app.e2e-spec.ts_0_4724
import {browser, element, by} from 'protractor'; describe('Pipes', () => { beforeAll(() => browser.get('')); it('should open correctly', async () => { expect(await element.all(by.tagName('h1')).get(0).getText()).toEqual('Pipes'); expect(await element(by.css('app-birthday p')).getText()).toEqual( `Th...
{ "end_byte": 4724, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/e2e/src/app.e2e-spec.ts" }
angular/adev/src/content/examples/pipes/src/index.html_0_252
<!DOCTYPE html> <html lang="en"> <head> <title>Pipes</title> <base href="/"> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 252, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/index.html" }
angular/adev/src/content/examples/pipes/src/main.ts_0_426
import {bootstrapApplication, provideProtractorTestingSupport} from '@angular/platform-browser'; import {provideHttpClient} from '@angular/common/http'; import {AppComponent} from './app/app.component'; bootstrapApplication(AppComponent, { // HttpClientModule is only used in deprecated HeroListComponent providers...
{ "end_byte": 426, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/main.ts" }
angular/adev/src/content/examples/pipes/src/app/app.component.html_0_1386
<h1 id="toc">Pipes</h1> <a href="#date-pipe">Date Pipe</a> <a href="#date-pipe-formatting">Date Pipe Formatting</a> <a href="#pipe-chaining">Pipe Chaining</a> <a href="#power-booster">Power Booster custom pipe</a> <a href="#hero-async-message">Async Messages and AsyncPipe</a> <a href="#json-pipe">Json Pipe for Debuggin...
{ "end_byte": 1386, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/app.component.html" }
angular/adev/src/content/examples/pipes/src/app/birthday.component.ts_0_343
import {Component} from '@angular/core'; import {DatePipe} from '@angular/common'; @Component({ standalone: true, selector: 'app-birthday', templateUrl: './birthday.component.html', imports: [DatePipe], }) export class BirthdayComponent { birthday = new Date(1988, 3, 15); // April 15, 1988 -- since month par...
{ "end_byte": 343, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/birthday.component.ts" }
angular/adev/src/content/examples/pipes/src/app/flying-heroes-impure.component.html_0_844
<!-- #docplaster--> <!-- #docregion --> <h2>{{ title }}</h2> <label for="hero-name">New hero: </label> <input type="text" id="hero-name" #box (keyup.enter)="addHero(box.value); box.value=''" placeholder="hero name"> <div> <input id="can-fly" type="checkbox" [(ngModel)]="canFly"> <label for="can-fly">can fly</label...
{ "end_byte": 844, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/flying-heroes-impure.component.html" }
angular/adev/src/content/examples/pipes/src/app/json-pipe.component.ts_0_365
import {Component} from '@angular/core'; import {JsonPipe} from '@angular/common'; @Component({ standalone: true, selector: 'app-json-pipe', template: `{{ data | json }}`, imports: [JsonPipe], }) export class JsonPipeComponent { data = { name: 'John Doe', age: 30, address: { street: '123 Ma...
{ "end_byte": 365, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/json-pipe.component.ts" }
angular/adev/src/content/examples/pipes/src/app/birthday-pipe-chaining.component.html_0_209
<p> The chained hero's uppercase birthday is {{ birthday | date | uppercase }} </p> <p> The chained hero's uppercase birthday in "fullDate" format is {{ birthday | date:'fullDate' | uppercase }} </p>
{ "end_byte": 209, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/birthday-pipe-chaining.component.html" }
angular/adev/src/content/examples/pipes/src/app/power-booster.component.ts_0_364
import {Component} from '@angular/core'; import {ExponentialStrengthPipe} from './exponential-strength.pipe'; @Component({ standalone: true, selector: 'app-power-booster', template: ` <h2>Power Booster</h2> <p>Super power boost: {{2 | exponentialStrength: 10}}</p> `, imports: [ExponentialStrengthPipe...
{ "end_byte": 364, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/power-booster.component.ts" }
angular/adev/src/content/examples/pipes/src/app/flying-heroes.pipe.ts_0_685
// #docregion // #docregion pure import {Pipe, PipeTransform} from '@angular/core'; import {Hero} from './heroes'; @Pipe({ standalone: true, name: 'flyingHeroes', }) export class FlyingHeroesPipe implements PipeTransform { transform(allHeroes: Hero[]) { // #docregion filter return allHeroes.filter((hero...
{ "end_byte": 685, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/flying-heroes.pipe.ts" }
angular/adev/src/content/examples/pipes/src/app/heroes.ts_0_241
export interface Hero { name: string; canFly: boolean; } export const HEROES: Hero[] = [ {name: 'Windstorm', canFly: true}, {name: 'Bombasto', canFly: false}, {name: 'Magneto', canFly: false}, {name: 'Tornado', canFly: true}, ];
{ "end_byte": 241, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/heroes.ts" }
angular/adev/src/content/examples/pipes/src/app/birthday.component.html_0_52
<p>The hero's birthday is {{ birthday | date }}</p>
{ "end_byte": 52, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/birthday.component.html" }
angular/adev/src/content/examples/pipes/src/app/app.component.ts_0_1339
import {Component} from '@angular/core'; import {BirthdayComponent} from './birthday.component'; import {BirthdayFormattingComponent} from './birthday-formatting.component'; import {BirthdayPipeChainingComponent} from './birthday-pipe-chaining.component'; import {FlyingHeroesComponent, FlyingHeroesImpureComponent} fro...
{ "end_byte": 1339, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/app.component.ts" }
angular/adev/src/content/examples/pipes/src/app/hero-async-message.component.ts_0_964
import {Component} from '@angular/core'; import {AsyncPipe} from '@angular/common'; import {Observable, interval} from 'rxjs'; import {map, startWith, take} from 'rxjs/operators'; @Component({ standalone: true, selector: 'app-hero-async-message', template: ` <h2>Async Messages and AsyncPipe</h2> <p>{{ m...
{ "end_byte": 964, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/hero-async-message.component.ts" }
angular/adev/src/content/examples/pipes/src/app/precedence.component.html_0_1138
<!-- #docregion --> <!-- #docregion precedence --> <p> In most cases, you'll wrap the entire ternary expression in parentheses before passing the result to a pipe. </p> <p> Example: <code>(isLeft ? 'left' : 'right') | uppercase</code> <b> {{ (isLeft ? 'left' : 'right') | uppercase }} </b> </p> <button type...
{ "end_byte": 1138, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/precedence.component.html" }
angular/adev/src/content/examples/pipes/src/app/flying-heroes.component.ts_0_1985
// #docplaster // #docregion import {Component} from '@angular/core'; import {CommonModule} from '@angular/common'; import {FormsModule} from '@angular/forms'; import {FlyingHeroesPipe, FlyingHeroesImpurePipe} from './flying-heroes.pipe'; import {HEROES} from './heroes'; @Component({ standalone: true, selector: '...
{ "end_byte": 1985, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/flying-heroes.component.ts" }
angular/adev/src/content/examples/pipes/src/app/flying-heroes.component.html_0_1162
<!-- #docplaster--> <!-- #docregion --> <h2>{{ title }}</h2> <p>Create a new hero and press enter to add it to the list. </p> <!-- #docregion template-1 --> <label for="hero-name">New hero name: </label> <input type="text" #box id="hero-name" (keyup.enter)="addHero(box.value); box.value=''" placeholder="hero name"> <!-...
{ "end_byte": 1162, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/flying-heroes.component.html" }
angular/adev/src/content/examples/pipes/src/app/birthday-formatting.component.ts_0_522
import {Component} from '@angular/core'; import {DatePipe} from '@angular/common'; @Component({ standalone: true, selector: 'app-birthday-formatting', templateUrl: './birthday-formatting.component.html', imports: [DatePipe], }) export class BirthdayFormattingComponent { birthday = new Date(1988, 3, 15); // A...
{ "end_byte": 522, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/birthday-formatting.component.ts" }
angular/adev/src/content/examples/pipes/src/app/precedence.component.ts_0_577
import {Component} from '@angular/core'; import {UpperCasePipe} from '@angular/common'; @Component({ standalone: true, selector: 'app-pipe-precedence', templateUrl: './precedence.component.html', imports: [UpperCasePipe], styles: ['code {font-family: monospace; background-color: #eee; padding: 0.5em;}'], }) ...
{ "end_byte": 577, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/precedence.component.ts" }
angular/adev/src/content/examples/pipes/src/app/exponential-strength.pipe.ts_0_539
import {Pipe, PipeTransform} from '@angular/core'; /* * Raise the value exponentially * Takes an exponent argument that defaults to 1. * Usage: * value | exponentialStrength:exponent * Example: * {{ 2 | exponentialStrength:10 }} * formats to: 1024 */ // #docregion pipe-class @Pipe({ standalone: true, ...
{ "end_byte": 539, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/exponential-strength.pipe.ts" }
angular/adev/src/content/examples/pipes/src/app/birthday-formatting.component.html_0_293
<p>The hero's birthday is {{ birthday | date:"shortDate" }} in the "shortDate" format.</p> <p>The hero's birthday is {{ birthday | date:format }} in "{{ format }}" format. Click the toggle button to change formats.</p> <button type="button" (click)="toggleFormat()">Toggle Format</button>
{ "end_byte": 293, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/birthday-formatting.component.html" }
angular/adev/src/content/examples/pipes/src/app/birthday-pipe-chaining.component.ts_0_413
import {Component} from '@angular/core'; import {DatePipe, UpperCasePipe} from '@angular/common'; @Component({ standalone: true, selector: 'app-birthday-pipe-chaining', templateUrl: './birthday-pipe-chaining.component.html', imports: [DatePipe, UpperCasePipe], }) export class BirthdayPipeChainingComponent { ...
{ "end_byte": 413, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/pipes/src/app/birthday-pipe-chaining.component.ts" }
angular/adev/src/content/examples/testing/BUILD.bazel_0_1800
package(default_visibility = ["//visibility:public"]) exports_files([ "src/app/about/about.component.spec.ts", "src/app/about/about.component.ts", "src/app/app.component.html", "src/app/app.component.spec.ts", "src/app/banner/banner.component.detect-changes.spec.ts", "src/app/banner/banner.comp...
{ "end_byte": 1800, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/BUILD.bazel" }
angular/adev/src/content/examples/testing/e2e/src/app.e2e-spec.ts_0_807
import {browser, element, by} from 'protractor'; describe('Testing Example', () => { const expectedViewNames = ['Dashboard', 'Heroes', 'About']; beforeAll(() => browser.get('')); function getPageElts() { return { navElts: element.all(by.css('app-root nav a')), appDashboard: element(by.css('app-...
{ "end_byte": 807, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/e2e/src/app.e2e-spec.ts" }
angular/adev/src/content/examples/testing/src/index.html_0_291
<!-- Run the test app--> <!DOCTYPE html> <html lang="en"> <head> <base href="/" /> <title>App Under Test</title> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> </head> <body> <app-root></app-root> </body> </html>
{ "end_byte": 291, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/index.html" }
angular/adev/src/content/examples/testing/src/main.ts_0_265
// main app entry point import {bootstrapApplication} from '@angular/platform-browser'; import {AppComponent} from './app/app.component'; import {appConfig} from './app/app.config'; bootstrapApplication(AppComponent, appConfig).catch((err) => console.error(err));
{ "end_byte": 265, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/main.ts" }
angular/adev/src/content/examples/testing/src/index-specs.html_0_147
<!-- Intentionally empty placeholder for Stackblitz. Do not need index.html in zip-download either as you should run tests with `npm test` -->
{ "end_byte": 147, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/index-specs.html" }
angular/adev/src/content/examples/testing/src/expected.ts_0_89
/* Ignore. Satisfies static analysis of router config in app.component.router.spec.ts */
{ "end_byte": 89, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/expected.ts" }
angular/adev/src/content/examples/testing/src/test.css_0_54
@import '~jasmine-core/lib/jasmine-core/jasmine.css';
{ "end_byte": 54, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/test.css" }
angular/adev/src/content/examples/testing/src/app/app.component.html_0_289
<!-- #docregion --> <app-banner></app-banner> <app-welcome></app-welcome> <!-- #docregion links --> <nav> <a routerLink="/dashboard">Dashboard</a> <a routerLink="/heroes">Heroes</a> <a routerLink="/about">About</a> </nav> <!-- #enddocregion links --> <router-outlet></router-outlet>
{ "end_byte": 289, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app.component.html" }
angular/adev/src/content/examples/testing/src/app/in-memory-data.service.ts_0_701
import {InMemoryDbService} from 'angular-in-memory-web-api'; import {QUOTES} from './twain/twain.data'; // Adjust to reduce number of quotes const maxQuotes = Infinity; // 0; /** Create in-memory database of heroes and quotes */ export class InMemoryDataService implements InMemoryDbService { createDb() { const ...
{ "end_byte": 701, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/in-memory-data.service.ts" }
angular/adev/src/content/examples/testing/src/app/app-initial.component.ts_0_273
// #docregion // Reduced version of the initial AppComponent generated by CLI import {Component} from '@angular/core'; @Component({ standalone: true, selector: 'app-root', template: '<h1>Welcome to {{title}}!</h1>', }) export class AppComponent { title = 'app'; }
{ "end_byte": 273, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app-initial.component.ts" }
angular/adev/src/content/examples/testing/src/app/app.routes.ts_0_429
import {Routes} from '@angular/router'; import {AboutComponent} from './about/about.component'; import {DashboardComponent} from './dashboard/dashboard.component'; export const routes: Routes = [ {path: '', redirectTo: 'dashboard', pathMatch: 'full'}, {path: 'about', component: AboutComponent}, {path: 'dashboar...
{ "end_byte": 429, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app.routes.ts" }
angular/adev/src/content/examples/testing/src/app/app.component.spec.ts_0_3598
// #docplaster import {Component, DebugElement, NO_ERRORS_SCHEMA} from '@angular/core'; import {ComponentFixture, fakeAsync, TestBed, tick, waitForAsync} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; import {provideRouter, Router, RouterLink} from '@angular/router'; import {AppComponent} ...
{ "end_byte": 3598, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app.component.spec.ts" }
angular/adev/src/content/examples/testing/src/app/app.component.router.spec.ts_0_5292
// For more examples: // https://github.com/angular/angular/blob/main/packages/router/test/integration.spec.ts import {Location} from '@angular/common'; import {provideLocationMocks, SpyLocation} from '@angular/common/testing'; import {DebugElement, Type} from '@angular/core'; import {ComponentFixture, fakeAsync, Te...
{ "end_byte": 5292, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app.component.router.spec.ts" }
angular/adev/src/content/examples/testing/src/app/app.component.ts_0_438
// #docregion import {Component} from '@angular/core'; import {RouterLink, RouterOutlet} from '@angular/router'; import {BannerComponent} from './banner/banner.component'; import {WelcomeComponent} from './welcome/welcome.component'; @Component({ standalone: true, selector: 'app-root', templateUrl: './app.compo...
{ "end_byte": 438, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app.component.ts" }
angular/adev/src/content/examples/testing/src/app/app.config.ts_0_1124
import {provideHttpClient} from '@angular/common/http'; import {ApplicationConfig, importProvidersFrom} from '@angular/core'; import {provideProtractorTestingSupport} from '@angular/platform-browser'; import {provideRouter} from '@angular/router'; import {HttpClientInMemoryWebApiModule} from 'angular-in-memory-web-api'...
{ "end_byte": 1124, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app.config.ts" }
angular/adev/src/content/examples/testing/src/app/app-initial.component.spec.ts_0_2050
// #docplaster // #docregion import {TestBed, waitForAsync} from '@angular/core/testing'; // #enddocregion import {AppComponent} from './app-initial.component'; /* // #docregion import { AppComponent } from './app.component'; describe('AppComponent', () => { // #enddocregion */ describe('AppComponent (initial CLI vers...
{ "end_byte": 2050, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/app-initial.component.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.spec.ts_0_5074
// #docplaster import {LightswitchComponent, MasterService, ValueService, ReversePipe} from './demo'; ///////// Fakes ///////// export class FakeValueService extends ValueService { override value = 'faked service value'; } //////////////////////// describe('demo (no TestBed):', () => { // #docregion ValueService ...
{ "end_byte": 5074, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.ts_0_7254
/* eslint-disable @angular-eslint/directive-selector, guard-for-in, @angular-eslint/no-input-rename */ import { Component, ContentChildren, Directive, EventEmitter, HostBinding, HostListener, Injectable, Input, OnChanges, OnDestroy, OnInit, Optional, Output, Pipe, PipeTransform, SimpleC...
{ "end_byte": 7254, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.ts_7255_11459
@Component({ standalone: true, selector: 'my-if-child-1', template: ` <h4>MyIfChildComp</h4> <div> <label for="child-value" >Child value: <input id="child-value" [(ngModel)]="childValue" /> </label> </div> <p><i>Change log:</i></p> @for (log of changeLog; track log; let i = $in...
{ "end_byte": 11459, "start_byte": 7255, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo-main.ts_0_188
// main app entry point import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {DemoModule} from './demo'; platformBrowserDynamic().bootstrapModule(DemoModule);
{ "end_byte": 188, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo-main.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts_0_5172
// #docplaster import {Component, DebugElement, Injectable} from '@angular/core'; import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync, } from '@angular/core/testing'; import {FormsModule, NgControl, NgModel} from '@angular/forms'; import {By} from '@angular/platform-browser'; import {...
{ "end_byte": 5172, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts_5176_14498
describe('TestBed component tests', () => { // beforeEach(waitForAsync(() => { // TestBed.configureTestingModule() // // Compile everything in DemoModule // .compileComponents(); // })); it('should create a component with inline template', () => { const fixture = TestBed.createC...
{ "end_byte": 14498, "start_byte": 5176, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts_14502_21328
describe('TestBed component overrides:', () => { it("should override ChildComp's template", () => { const fixture = TestBed.configureTestingModule({ imports: [Child1Component], }) .overrideComponent(Child1Component, { set: {template: '<span>Fake</span>'}, }) .cr...
{ "end_byte": 21328, "start_byte": 14502, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts_21332_25817
describe('lifecycle hooks w/ MyIfParentComp', () => { let fixture: ComponentFixture<MyIfParentComponent>; let parent: MyIfParentComponent; let child: MyIfChildComponent; beforeEach(() => { TestBed.configureTestingModule({ imports: [FormsModule, MyIfChildComponent, MyIfParentComponent], ...
{ "end_byte": 25817, "start_byte": 21332, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo.testbed.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/async-helper.spec.ts_0_6420
import {fakeAsync, tick, waitForAsync} from '@angular/core/testing'; import {interval, of} from 'rxjs'; import {delay, take} from 'rxjs/operators'; describe('Angular async helper', () => { describe('async', () => { let actuallyDone = false; beforeEach(() => { actuallyDone = false; }); afterEa...
{ "end_byte": 6420, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/async-helper.spec.ts" }
angular/adev/src/content/examples/testing/src/app/demo/demo-external-template.html_0_36
<span>from external template</span>
{ "end_byte": 36, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/demo/demo-external-template.html" }
angular/adev/src/content/examples/testing/src/app/shared/highlight.directive.ts_0_670
/* eslint-disable @angular-eslint/directive-selector */ // #docregion import {Directive, ElementRef, Input, OnChanges} from '@angular/core'; @Directive({standalone: true, selector: '[highlight]'}) /** * Set backgroundColor for the attached element to highlight color * and set the element's customProperty to true */...
{ "end_byte": 670, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/shared/highlight.directive.ts" }
angular/adev/src/content/examples/testing/src/app/shared/canvas.component.spec.ts_0_1085
// #docplaster // #docregion without-toBlob-macrotask import {fakeAsync, TestBed, tick} from '@angular/core/testing'; import {CanvasComponent} from './canvas.component'; describe('CanvasComponent', () => { // #enddocregion without-toBlob-macrotask // #docregion enable-toBlob-macrotask beforeEach(() => { (wi...
{ "end_byte": 1085, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/shared/canvas.component.spec.ts" }
angular/adev/src/content/examples/testing/src/app/shared/title-case.pipe.spec.ts_0_923
// #docplaster // #docregion import {TitleCasePipe} from './title-case.pipe'; // #docregion excerpt describe('TitleCasePipe', () => { // This pipe is a pure, stateless function so no need for BeforeEach const pipe = new TitleCasePipe(); it('transforms "abc" to "Abc"', () => { expect(pipe.transform('abc')).t...
{ "end_byte": 923, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/adev/src/content/examples/testing/src/app/shared/title-case.pipe.spec.ts" }