_id
stringlengths
21
254
text
stringlengths
1
93.7k
metadata
dict
angular/goldens/public-api/platform-browser/animations/async/index.api.md_0_394
## API Report File for "@angular/platform-browser_animations_async" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { EnvironmentProviders } from '@angular/core'; // @public export function provideAnimationsAsync(type?: 'animations' | 'noop'): EnvironmentProviders; // (No @packageDocumentation comment for this package) ```
{ "end_byte": 394, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/platform-browser/animations/async/index.api.md" }
angular/goldens/public-api/router/index.api.md_0_147
## API Report File for "@angular/router" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts
{ "end_byte": 147, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/index.api.md" }
angular/goldens/public-api/router/index.api.md_148_9140
import { AfterContentInit } from '@angular/core'; import { ChangeDetectorRef } from '@angular/core'; import { Compiler } from '@angular/core'; import { ComponentRef } from '@angular/core'; import { ElementRef } from '@angular/core'; import { EnvironmentInjector } from '@angular/core'; import { EnvironmentProviders } from '@angular/core'; import { EventEmitter } from '@angular/core'; import * as i0 from '@angular/core'; import { InjectionToken } from '@angular/core'; import { Injector } from '@angular/core'; import { InputSignal } from '@angular/core'; import { LocationStrategy } from '@angular/common'; import { ModuleWithProviders } from '@angular/core'; import { NgModuleFactory } from '@angular/core'; import { Observable } from 'rxjs'; import { OnChanges } from '@angular/core'; import { OnDestroy } from '@angular/core'; import { OnInit } from '@angular/core'; import { Provider } from '@angular/core'; import { ProviderToken } from '@angular/core'; import { QueryList } from '@angular/core'; import { Renderer2 } from '@angular/core'; import { RouterState as RouterState_2 } from '@angular/router'; import { Signal } from '@angular/core'; import { SimpleChanges } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { Type } from '@angular/core'; import { Version } from '@angular/core'; // @public export class ActivatedRoute { get children(): ActivatedRoute[]; component: Type<any> | null; data: Observable<Data>; get firstChild(): ActivatedRoute | null; fragment: Observable<string | null>; outlet: string; get paramMap(): Observable<ParamMap>; params: Observable<Params>; get parent(): ActivatedRoute | null; get pathFromRoot(): ActivatedRoute[]; get queryParamMap(): Observable<ParamMap>; queryParams: Observable<Params>; get root(): ActivatedRoute; get routeConfig(): Route | null; snapshot: ActivatedRouteSnapshot; readonly title: Observable<string | undefined>; // (undocumented) toString(): string; url: Observable<UrlSegment[]>; } // @public export class ActivatedRouteSnapshot { get children(): ActivatedRouteSnapshot[]; component: Type<any> | null; data: Data; get firstChild(): ActivatedRouteSnapshot | null; fragment: string | null; outlet: string; // (undocumented) get paramMap(): ParamMap; params: Params; get parent(): ActivatedRouteSnapshot | null; get pathFromRoot(): ActivatedRouteSnapshot[]; // (undocumented) get queryParamMap(): ParamMap; queryParams: Params; get root(): ActivatedRouteSnapshot; readonly routeConfig: Route | null; get title(): string | undefined; // (undocumented) toString(): string; url: UrlSegment[]; } // @public export class ActivationEnd { constructor( snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ActivationEnd; } // @public export class ActivationStart { constructor( snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ActivationStart; } // @public export abstract class BaseRouteReuseStrategy implements RouteReuseStrategy { retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null; shouldAttach(route: ActivatedRouteSnapshot): boolean; shouldDetach(route: ActivatedRouteSnapshot): boolean; shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean; store(route: ActivatedRouteSnapshot, detachedTree: DetachedRouteHandle): void; } // @public export interface CanActivate { // (undocumented) canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>; } // @public export interface CanActivateChild { // (undocumented) canActivateChild(childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<GuardResult>; } // @public export type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<GuardResult>; // @public export type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<GuardResult>; // @public export interface CanDeactivate<T> { // (undocumented) canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot): MaybeAsync<GuardResult>; } // @public export type CanDeactivateFn<T> = (component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot) => MaybeAsync<GuardResult>; // @public @deprecated export interface CanLoad { // (undocumented) canLoad(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>; } // @public @deprecated export type CanLoadFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>; // @public export interface CanMatch { // (undocumented) canMatch(route: Route, segments: UrlSegment[]): MaybeAsync<GuardResult>; } // @public export type CanMatchFn = (route: Route, segments: UrlSegment[]) => MaybeAsync<GuardResult>; // @public export class ChildActivationEnd { constructor( snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ChildActivationEnd; } // @public export class ChildActivationStart { constructor( snapshot: ActivatedRouteSnapshot); // (undocumented) snapshot: ActivatedRouteSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ChildActivationStart; } // @public export class ChildrenOutletContexts { constructor(rootInjector: EnvironmentInjector); // (undocumented) getContext(childName: string): OutletContext | null; // (undocumented) getOrCreateContext(childName: string): OutletContext; onChildOutletCreated(childName: string, outlet: RouterOutletContract): void; onChildOutletDestroyed(childName: string): void; onOutletDeactivated(): Map<string, OutletContext>; // (undocumented) onOutletReAttached(contexts: Map<string, OutletContext>): void; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<ChildrenOutletContexts, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<ChildrenOutletContexts>; } // @public export type ComponentInputBindingFeature = RouterFeature<RouterFeatureKind.ComponentInputBindingFeature>; // @public export function convertToParamMap(params: Params): ParamMap; // @public export function createUrlTreeFromSnapshot(relativeTo: ActivatedRouteSnapshot, commands: any[], queryParams?: Params | null, fragment?: string | null): UrlTree; // @public export type Data = { [key: string | symbol]: any; }; // @public export type DebugTracingFeature = RouterFeature<RouterFeatureKind.DebugTracingFeature>; // @public export interface DefaultExport<T> { default: T; } // @public export class DefaultTitleStrategy extends TitleStrategy { constructor(title: Title); // (undocumented) readonly title: Title; updateTitle(snapshot: RouterStateSnapshot): void; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<DefaultTitleStrategy, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<DefaultTitleStrategy>; } // @public export function defaultUrlMatcher(segments: UrlSegment[], segmentGroup: UrlSegmentGroup, route: Route): UrlMatchResult | null; // @public export class DefaultUrlSerializer implements UrlSerializer { parse(url: string): UrlTree; serialize(tree: UrlTree): string; } // @public @deprecated export type DeprecatedGuard = ProviderToken<any> | any; // @public export type DetachedRouteHandle = {}; // @public export type DisabledInitialNavigationFeature = RouterFeature<RouterFeatureKind.DisabledInitialNavigationFeature>; // @public export type EnabledBlockingInitialNavigationFeature = RouterFeature<RouterFeatureKind.EnabledBlockingInitialNavigationFeature>; // @public type Event_2 = NavigationStart | NavigationEnd | NavigationCancel | NavigationError | RoutesRecognized | GuardsCheckStart | GuardsCheckEnd | RouteConfigLoadStart | RouteConfigLoadEnd | ChildActivationStart | ChildActivationEnd | ActivationStart | ActivationEnd | Scroll | ResolveStart | ResolveEnd | NavigationSkipped; export { Event_2 as Event } // @public export enum EventType { // (undocumented) ActivationEnd = 14, // (undocumented) ActivationStart = 13, // (undocumented) ChildActivationEnd = 12, // (undocumented) ChildActivationStart = 11, // (undocumented) GuardsCheckEnd = 8, // (undocumented) GuardsCheckStart = 7, // (undocumented) Navigat
{ "end_byte": 9140, "start_byte": 148, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/index.api.md" }
angular/goldens/public-api/router/index.api.md_9141_17450
onCancel = 2, // (undocumented) NavigationEnd = 1, // (undocumented) NavigationError = 3, // (undocumented) NavigationSkipped = 16, // (undocumented) NavigationStart = 0, // (undocumented) ResolveEnd = 6, // (undocumented) ResolveStart = 5, // (undocumented) RouteConfigLoadEnd = 10, // (undocumented) RouteConfigLoadStart = 9, // (undocumented) RoutesRecognized = 4, // (undocumented) Scroll = 15 } // @public export interface ExtraOptions extends InMemoryScrollingOptions, RouterConfigOptions { bindToComponentInputs?: boolean; enableTracing?: boolean; enableViewTransitions?: boolean; errorHandler?: (error: any) => RedirectCommand | any; initialNavigation?: InitialNavigation; preloadingStrategy?: any; scrollOffset?: [number, number] | (() => [number, number]); useHash?: boolean; } // @public export type GuardResult = boolean | UrlTree | RedirectCommand; // @public export class GuardsCheckEnd extends RouterEvent { constructor( id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot, shouldActivate: boolean); // (undocumented) shouldActivate: boolean; // (undocumented) state: RouterStateSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.GuardsCheckEnd; // (undocumented) urlAfterRedirects: string; } // @public export class GuardsCheckStart extends RouterEvent { constructor( id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.GuardsCheckStart; // (undocumented) urlAfterRedirects: string; } // @public export type InitialNavigation = 'disabled' | 'enabledBlocking' | 'enabledNonBlocking'; // @public export type InitialNavigationFeature = EnabledBlockingInitialNavigationFeature | DisabledInitialNavigationFeature; // @public export type InMemoryScrollingFeature = RouterFeature<RouterFeatureKind.InMemoryScrollingFeature>; // @public export interface InMemoryScrollingOptions { anchorScrolling?: 'disabled' | 'enabled'; scrollPositionRestoration?: 'disabled' | 'enabled' | 'top'; } // @public export interface IsActiveMatchOptions { fragment: 'exact' | 'ignored'; matrixParams: 'exact' | 'subset' | 'ignored'; paths: 'exact' | 'subset'; queryParams: 'exact' | 'subset' | 'ignored'; } // @public export type LoadChildren = LoadChildrenCallback; // @public export type LoadChildrenCallback = () => Type<any> | NgModuleFactory<any> | Routes | Observable<Type<any> | Routes | DefaultExport<Type<any>> | DefaultExport<Routes>> | Promise<NgModuleFactory<any> | Type<any> | Routes | DefaultExport<Type<any>> | DefaultExport<Routes>>; // @public export function mapToCanActivate(providers: Array<Type<CanActivate>>): CanActivateFn[]; // @public export function mapToCanActivateChild(providers: Array<Type<CanActivateChild>>): CanActivateChildFn[]; // @public export function mapToCanDeactivate<T = unknown>(providers: Array<Type<CanDeactivate<T>>>): CanDeactivateFn<T>[]; // @public export function mapToCanMatch(providers: Array<Type<CanMatch>>): CanMatchFn[]; // @public export function mapToResolve<T>(provider: Type<Resolve<T>>): ResolveFn<T>; // @public export type MaybeAsync<T> = T | Observable<T> | Promise<T>; // @public export interface Navigation { extractedUrl: UrlTree; extras: NavigationExtras; finalUrl?: UrlTree; id: number; initialUrl: UrlTree; previousNavigation: Navigation | null; trigger: 'imperative' | 'popstate' | 'hashchange'; } // @public export interface NavigationBehaviorOptions { readonly browserUrl?: UrlTree | string; readonly info?: unknown; onSameUrlNavigation?: OnSameUrlNavigation; replaceUrl?: boolean; skipLocationChange?: boolean; state?: { [k: string]: any; }; } // @public export class NavigationCancel extends RouterEvent { constructor( id: number, url: string, reason: string, code?: NavigationCancellationCode | undefined); readonly code?: NavigationCancellationCode | undefined; reason: string; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationCancel; } // @public export enum NavigationCancellationCode { GuardRejected = 3, NoDataFromResolver = 2, Redirect = 0, SupersededByNewNavigation = 1 } // @public export class NavigationEnd extends RouterEvent { constructor( id: number, url: string, urlAfterRedirects: string); // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationEnd; // (undocumented) urlAfterRedirects: string; } // @public export class NavigationError extends RouterEvent { constructor( id: number, url: string, error: any, target?: RouterStateSnapshot | undefined); // (undocumented) error: any; readonly target?: RouterStateSnapshot | undefined; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationError; } // @public export type NavigationErrorHandlerFeature = RouterFeature<RouterFeatureKind.NavigationErrorHandlerFeature>; // @public export interface NavigationExtras extends UrlCreationOptions, NavigationBehaviorOptions { } // @public export class NavigationSkipped extends RouterEvent { constructor( id: number, url: string, reason: string, code?: NavigationSkippedCode | undefined); readonly code?: NavigationSkippedCode | undefined; reason: string; // (undocumented) readonly type = EventType.NavigationSkipped; } // @public export enum NavigationSkippedCode { IgnoredByUrlHandlingStrategy = 1, IgnoredSameUrlNavigation = 0 } // @public export class NavigationStart extends RouterEvent { constructor( id: number, url: string, navigationTrigger?: NavigationTrigger, restoredState?: { [k: string]: any; navigationId: number; } | null); navigationTrigger?: NavigationTrigger; restoredState?: { [k: string]: any; navigationId: number; } | null; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.NavigationStart; } // @public export class NoPreloading implements PreloadingStrategy { // (undocumented) preload(route: Route, fn: () => Observable<any>): Observable<any>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<NoPreloading, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<NoPreloading>; } // @public export type OnSameUrlNavigation = 'reload' | 'ignore'; // @public export class OutletContext { constructor(rootInjector: EnvironmentInjector); // (undocumented) attachRef: ComponentRef<any> | null; // (undocumented) children: ChildrenOutletContexts; // (undocumented) get injector(): EnvironmentInjector; // (undocumented) outlet: RouterOutletContract | null; // (undocumented) route: ActivatedRoute | null; } // @public export interface ParamMap { get(name: string): string | null; getAll(name: string): string[]; has(name: string): boolean; readonly keys: string[]; } // @public export type Params = { [key: string]: any; }; // @public export class PreloadAllModules implements PreloadingStrategy { // (undocumented) preload(route: Route, fn: () => Observable<any>): Observable<any>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<PreloadAllModules, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<PreloadAllModules>; } // @public export type PreloadingFeature = RouterFeature<RouterFeatureKind.PreloadingFeature>; // @public export abstract class PreloadingStrategy { // (undocumented) abstract preload(route: Route, fn: () => Observable<any>): Observable<any>; } // @public export const PRIMARY_OUTLET = "primary"; // @public export function provideRouter(routes: Routes, ...features: RouterFeatures[]): EnvironmentProviders; // @public @deprecated
{ "end_byte": 17450, "start_byte": 9141, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/index.api.md" }
angular/goldens/public-api/router/index.api.md_17451_25994
export function provideRoutes(routes: Routes): Provider[]; // @public export type QueryParamsHandling = 'merge' | 'preserve' | 'replace' | ''; // @public export class RedirectCommand { constructor(redirectTo: UrlTree, navigationBehaviorOptions?: NavigationBehaviorOptions | undefined); // (undocumented) readonly navigationBehaviorOptions?: NavigationBehaviorOptions | undefined; // (undocumented) readonly redirectTo: UrlTree; } // @public export type RedirectFunction = (redirectData: Pick<ActivatedRouteSnapshot, 'routeConfig' | 'url' | 'params' | 'queryParams' | 'fragment' | 'data' | 'outlet' | 'title'>) => string | UrlTree; // @public export interface Resolve<T> { // (undocumented) resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): MaybeAsync<T | RedirectCommand>; } // @public export type ResolveData = { [key: string | symbol]: ResolveFn<unknown> | DeprecatedGuard; }; // @public export class ResolveEnd extends RouterEvent { constructor( id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ResolveEnd; // (undocumented) urlAfterRedirects: string; } // @public export type ResolveFn<T> = (route: ActivatedRouteSnapshot, state: RouterStateSnapshot) => MaybeAsync<T | RedirectCommand>; // @public export class ResolveStart extends RouterEvent { constructor( id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.ResolveStart; // (undocumented) urlAfterRedirects: string; } // @public export interface Route { canActivate?: Array<CanActivateFn | DeprecatedGuard>; canActivateChild?: Array<CanActivateChildFn | DeprecatedGuard>; canDeactivate?: Array<CanDeactivateFn<any> | DeprecatedGuard>; // @deprecated canLoad?: Array<CanLoadFn | DeprecatedGuard>; canMatch?: Array<CanMatchFn | DeprecatedGuard>; children?: Routes; component?: Type<any>; data?: Data; loadChildren?: LoadChildren; loadComponent?: () => Type<unknown> | Observable<Type<unknown> | DefaultExport<Type<unknown>>> | Promise<Type<unknown> | DefaultExport<Type<unknown>>>; matcher?: UrlMatcher; outlet?: string; path?: string; pathMatch?: 'prefix' | 'full'; providers?: Array<Provider | EnvironmentProviders>; redirectTo?: string | RedirectFunction; resolve?: ResolveData; runGuardsAndResolvers?: RunGuardsAndResolvers; title?: string | Type<Resolve<string>> | ResolveFn<string>; } // @public export class RouteConfigLoadEnd { constructor( route: Route); // (undocumented) route: Route; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.RouteConfigLoadEnd; } // @public export class RouteConfigLoadStart { constructor( route: Route); // (undocumented) route: Route; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.RouteConfigLoadStart; } // @public export class Router { constructor(); readonly componentInputBindingEnabled: boolean; // (undocumented) config: Routes; createUrlTree(commands: any[], navigationExtras?: UrlCreationOptions): UrlTree; dispose(): void; get events(): Observable<Event_2>; getCurrentNavigation(): Navigation | null; initialNavigation(): void; // @deprecated isActive(url: string | UrlTree, exact: boolean): boolean; isActive(url: string | UrlTree, matchOptions: IsActiveMatchOptions): boolean; get lastSuccessfulNavigation(): Navigation | null; navigate(commands: any[], extras?: NavigationExtras): Promise<boolean>; navigateByUrl(url: string | UrlTree, extras?: NavigationBehaviorOptions): Promise<boolean>; navigated: boolean; // (undocumented) ngOnDestroy(): void; // @deprecated onSameUrlNavigation: OnSameUrlNavigation; parseUrl(url: string): UrlTree; resetConfig(config: Routes): void; // @deprecated routeReuseStrategy: RouteReuseStrategy; get routerState(): RouterState_2; serializeUrl(url: UrlTree): string; setUpLocationChangeListener(): void; get url(): string; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<Router, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<Router>; } // @public export const ROUTER_CONFIGURATION: InjectionToken<ExtraOptions>; // @public export const ROUTER_INITIALIZER: InjectionToken<(compRef: ComponentRef<any>) => void>; // @public export const ROUTER_OUTLET_DATA: InjectionToken<Signal<unknown>>; // @public export interface RouterConfigOptions { canceledNavigationResolution?: 'replace' | 'computed'; defaultQueryParamsHandling?: QueryParamsHandling; onSameUrlNavigation?: OnSameUrlNavigation; paramsInheritanceStrategy?: 'emptyOnly' | 'always'; resolveNavigationPromiseOnError?: boolean; urlUpdateStrategy?: 'deferred' | 'eager'; } // @public export type RouterConfigurationFeature = RouterFeature<RouterFeatureKind.RouterConfigurationFeature>; // @public export abstract class RouteReuseStrategy { abstract retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null; abstract shouldAttach(route: ActivatedRouteSnapshot): boolean; abstract shouldDetach(route: ActivatedRouteSnapshot): boolean; abstract shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean; abstract store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle | null): void; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouteReuseStrategy, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<RouteReuseStrategy>; } // @public export class RouterEvent { constructor( id: number, url: string); id: number; url: string; } // @public export interface RouterFeature<FeatureKind extends RouterFeatureKind> { // (undocumented) ɵkind: FeatureKind; // (undocumented) ɵproviders: Provider[]; } // @public export type RouterFeatures = PreloadingFeature | DebugTracingFeature | InitialNavigationFeature | InMemoryScrollingFeature | RouterConfigurationFeature | NavigationErrorHandlerFeature | ComponentInputBindingFeature | ViewTransitionsFeature | RouterHashLocationFeature; // @public export type RouterHashLocationFeature = RouterFeature<RouterFeatureKind.RouterHashLocationFeature>; // @public class RouterLink implements OnChanges, OnDestroy { constructor(router: Router, route: ActivatedRoute, tabIndexAttribute: string | null | undefined, renderer: Renderer2, el: ElementRef, locationStrategy?: LocationStrategy | undefined); fragment?: string; href: string | null; info?: unknown; // (undocumented) static ngAcceptInputType_preserveFragment: unknown; // (undocumented) static ngAcceptInputType_replaceUrl: unknown; // (undocumented) static ngAcceptInputType_skipLocationChange: unknown; // (undocumented) ngOnChanges(changes?: SimpleChanges): void; // (undocumented) ngOnDestroy(): any; // (undocumented) onClick(button: number, ctrlKey: boolean, shiftKey: boolean, altKey: boolean, metaKey: boolean): boolean; preserveFragment: boolean; queryParams?: Params | null; queryParamsHandling?: QueryParamsHandling | null; relativeTo?: ActivatedRoute | null; replaceUrl: boolean; set routerLink(commandsOrUrlTree: any[] | string | UrlTree | null | undefined); skipLocationChange: boolean; state?: { [k: string]: any; }; target?: string; // (undocumented) get urlTree(): UrlTree | null; // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLink, "[routerLink]", never, { "target": { "alias": "target"; "required": false; }; "queryParams": { "alias": "queryParams"; "required": false; }; "fragment": { "alias": "fragment"; "required": false; }; "queryParamsHandling": { "alias": "queryParamsHandling"; "required": false; }; "state": { "alias": "state"; "required": false; }; "info": { "alias": "info"; "required": false; }; "relativeTo": { "alias": "relativeTo"; "required": false; }; "preserveFragment": { "alias": "preserveFragment"; "required": false; }; "skipLocationChange": { "alia
{ "end_byte": 25994, "start_byte": 17451, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/index.api.md" }
angular/goldens/public-api/router/index.api.md_25994_34165
s": "skipLocationChange"; "required": false; }; "replaceUrl": { "alias": "replaceUrl"; "required": false; }; "routerLink": { "alias": "routerLink"; "required": false; }; }, {}, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouterLink, [null, null, { attribute: "tabindex"; }, null, null, null]>; } export { RouterLink } export { RouterLink as RouterLinkWithHref } // @public export class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit { constructor(router: Router, element: ElementRef, renderer: Renderer2, cdr: ChangeDetectorRef, link?: RouterLink | undefined); ariaCurrentWhenActive?: 'page' | 'step' | 'location' | 'date' | 'time' | true | false; // (undocumented) get isActive(): boolean; readonly isActiveChange: EventEmitter<boolean>; // (undocumented) links: QueryList<RouterLink>; // (undocumented) ngAfterContentInit(): void; // (undocumented) ngOnChanges(changes: SimpleChanges): void; // (undocumented) ngOnDestroy(): void; // (undocumented) set routerLinkActive(data: string[] | string); routerLinkActiveOptions: { exact: boolean; } | IsActiveMatchOptions; // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration<RouterLinkActive, "[routerLinkActive]", ["routerLinkActive"], { "routerLinkActiveOptions": { "alias": "routerLinkActiveOptions"; "required": false; }; "ariaCurrentWhenActive": { "alias": "ariaCurrentWhenActive"; "required": false; }; "routerLinkActive": { "alias": "routerLinkActive"; "required": false; }; }, { "isActiveChange": "isActiveChange"; }, ["links"], never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouterLinkActive, [null, null, null, null, { optional: true; }]>; } // @public export class RouterModule { constructor(guard: any); static forChild(routes: Routes): ModuleWithProviders<RouterModule>; static forRoot(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterModule>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouterModule, [{ optional: true; }]>; // (undocumented) static ɵinj: i0.ɵɵInjectorDeclaration<RouterModule>; // (undocumented) static ɵmod: i0.ɵɵNgModuleDeclaration<RouterModule, never, [typeof i1.RouterOutlet, typeof i2.RouterLink, typeof i3.RouterLinkActive, typeof i4.ɵEmptyOutletComponent], [typeof i1.RouterOutlet, typeof i2.RouterLink, typeof i3.RouterLinkActive, typeof i4.ɵEmptyOutletComponent]>; } // @public export class RouterOutlet implements OnDestroy, OnInit, RouterOutletContract { // (undocumented) get activatedRoute(): ActivatedRoute; // (undocumented) get activatedRouteData(): Data; // (undocumented) activateEvents: EventEmitter<any>; // (undocumented) activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector): void; attach(ref: ComponentRef<any>, activatedRoute: ActivatedRoute): void; attachEvents: EventEmitter<unknown>; // (undocumented) get component(): Object; // (undocumented) deactivate(): void; // (undocumented) deactivateEvents: EventEmitter<any>; detach(): ComponentRef<any>; detachEvents: EventEmitter<unknown>; // (undocumented) get isActivated(): boolean; name: string; // (undocumented) ngOnChanges(changes: SimpleChanges): void; // (undocumented) ngOnDestroy(): void; // (undocumented) ngOnInit(): void; readonly routerOutletData: InputSignal<unknown>; // (undocumented) readonly supportsBindingToComponentInputs = true; // (undocumented) static ɵdir: i0.ɵɵDirectiveDeclaration<RouterOutlet, "router-outlet", ["outlet"], { "name": { "alias": "name"; "required": false; }; "routerOutletData": { "alias": "routerOutletData"; "required": false; "isSignal": true; }; }, { "activateEvents": "activate"; "deactivateEvents": "deactivate"; "attachEvents": "attach"; "detachEvents": "detach"; }, never, never, true, never>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouterOutlet, never>; } // @public export interface RouterOutletContract { activatedRoute: ActivatedRoute | null; activatedRouteData: Data; activateEvents?: EventEmitter<unknown>; activateWith(activatedRoute: ActivatedRoute, environmentInjector: EnvironmentInjector): void; attach(ref: ComponentRef<unknown>, activatedRoute: ActivatedRoute): void; attachEvents?: EventEmitter<unknown>; component: Object | null; deactivate(): void; deactivateEvents?: EventEmitter<unknown>; detach(): ComponentRef<unknown>; detachEvents?: EventEmitter<unknown>; isActivated: boolean; readonly supportsBindingToComponentInputs?: true; } // @public export class RouterPreloader implements OnDestroy { constructor(router: Router, compiler: Compiler, injector: EnvironmentInjector, preloadingStrategy: PreloadingStrategy, loader: RouterConfigLoader); // (undocumented) ngOnDestroy(): void; // (undocumented) preload(): Observable<any>; // (undocumented) setUpPreloading(): void; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouterPreloader, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<RouterPreloader>; } // @public export class RouterState extends Tree<ActivatedRoute> { snapshot: RouterStateSnapshot; // (undocumented) toString(): string; } // @public export class RouterStateSnapshot extends Tree<ActivatedRouteSnapshot> { // (undocumented) toString(): string; url: string; } // @public export const ROUTES: InjectionToken<Route[][]>; // @public export type Routes = Route[]; // @public export class RoutesRecognized extends RouterEvent { constructor( id: number, url: string, urlAfterRedirects: string, state: RouterStateSnapshot); // (undocumented) state: RouterStateSnapshot; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.RoutesRecognized; // (undocumented) urlAfterRedirects: string; } // @public export type RunGuardsAndResolvers = 'pathParamsChange' | 'pathParamsOrQueryParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always' | ((from: ActivatedRouteSnapshot, to: ActivatedRouteSnapshot) => boolean); // @public export class Scroll { constructor( routerEvent: NavigationEnd | NavigationSkipped, position: [number, number] | null, anchor: string | null); // (undocumented) readonly anchor: string | null; // (undocumented) readonly position: [number, number] | null; // (undocumented) readonly routerEvent: NavigationEnd | NavigationSkipped; // (undocumented) toString(): string; // (undocumented) readonly type = EventType.Scroll; } // @public export abstract class TitleStrategy { // (undocumented) buildTitle(snapshot: RouterStateSnapshot): string | undefined; getResolvedTitleForRoute(snapshot: ActivatedRouteSnapshot): any; abstract updateTitle(snapshot: RouterStateSnapshot): void; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<TitleStrategy, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<TitleStrategy>; } // @public export interface UrlCreationOptions { fragment?: string; preserveFragment?: boolean; queryParams?: Params | null; queryParamsHandling?: QueryParamsHandling | null; relativeTo?: ActivatedRoute | null; } // @public export abstract class UrlHandlingStrategy { abstract extract(url: UrlTree): UrlTree; abstract merge(newUrlPart: UrlTree, rawUrl: UrlTree): UrlTree; abstract shouldProcessUrl(url: UrlTree): boolean; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<UrlHandlingStrategy, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<UrlHandlingStrategy>; } // @public export type UrlMatcher = (segments: UrlSegment[], group: UrlSegmentGroup, route: Route) => UrlMatchResult | null; // @public export type UrlMatchResult = { consumed: UrlSegment[]; posParams?: { [name: string]: UrlSegment; }; }; // @p
{ "end_byte": 34165, "start_byte": 25994, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/index.api.md" }
angular/goldens/public-api/router/index.api.md_34176_37291
t class UrlSegment { constructor( path: string, parameters: { [name: string]: string; }); // (undocumented) get parameterMap(): ParamMap; parameters: { [name: string]: string; }; path: string; // (undocumented) toString(): string; } // @public export class UrlSegmentGroup { constructor( segments: UrlSegment[], children: { [key: string]: UrlSegmentGroup; }); children: { [key: string]: UrlSegmentGroup; }; hasChildren(): boolean; get numberOfChildren(): number; parent: UrlSegmentGroup | null; segments: UrlSegment[]; // (undocumented) toString(): string; } // @public export abstract class UrlSerializer { abstract parse(url: string): UrlTree; abstract serialize(tree: UrlTree): string; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<UrlSerializer, never>; // (undocumented) static ɵprov: i0.ɵɵInjectableDeclaration<UrlSerializer>; } // @public export class UrlTree { constructor( root?: UrlSegmentGroup, queryParams?: Params, fragment?: string | null); fragment: string | null; // (undocumented) get queryParamMap(): ParamMap; queryParams: Params; root: UrlSegmentGroup; // (undocumented) toString(): string; } // @public (undocumented) export const VERSION: Version; // @public export interface ViewTransitionInfo { from: ActivatedRouteSnapshot; to: ActivatedRouteSnapshot; transition: { finished: Promise<void>; ready: Promise<void>; updateCallbackDone: Promise<void>; skipTransition(): void; }; } // @public export type ViewTransitionsFeature = RouterFeature<RouterFeatureKind.ViewTransitionsFeature>; // @public export interface ViewTransitionsFeatureOptions { onViewTransitionCreated?: (transitionInfo: ViewTransitionInfo) => void; skipInitialTransition?: boolean; } // @public export function withComponentInputBinding(): ComponentInputBindingFeature; // @public export function withDebugTracing(): DebugTracingFeature; // @public export function withDisabledInitialNavigation(): DisabledInitialNavigationFeature; // @public export function withEnabledBlockingInitialNavigation(): EnabledBlockingInitialNavigationFeature; // @public export function withHashLocation(): RouterHashLocationFeature; // @public export function withInMemoryScrolling(options?: InMemoryScrollingOptions): InMemoryScrollingFeature; // @public export function withNavigationErrorHandler(handler: (error: NavigationError) => unknown | RedirectCommand): NavigationErrorHandlerFeature; // @public export function withPreloading(preloadingStrategy: Type<PreloadingStrategy>): PreloadingFeature; // @public export function withRouterConfig(options: RouterConfigOptions): RouterConfigurationFeature; // @public export function withViewTransitions(options?: ViewTransitionsFeatureOptions): ViewTransitionsFeature; // (No @packageDocumentation comment for this package) ```
{ "end_byte": 37291, "start_byte": 34176, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/index.api.md" }
angular/goldens/public-api/router/errors.api.md_0_1255
## API Report File for "angular-srcs" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts // @public export const enum RuntimeErrorCode { // (undocumented) EMPTY_PATH_WITH_PARAMS = 4009, // (undocumented) FOR_ROOT_CALLED_TWICE = 4007, // (undocumented) INFINITE_REDIRECT = 4016, // (undocumented) INVALID_DOUBLE_DOTS = 4005, // (undocumented) INVALID_ROOT_URL_SEGMENT = 4015, // (undocumented) INVALID_ROUTE_CONFIG = 4014, // (undocumented) INVALID_ROUTER_LINK_INPUTS = 4016, // (undocumented) MISPLACED_OUTLETS_COMMAND = 4004, // (undocumented) MISSING_REDIRECT = 4001, // (undocumented) NAMED_OUTLET_REDIRECT = 4000, // (undocumented) NO_MATCH = 4002, // (undocumented) NULLISH_COMMAND = 4008, // (undocumented) OUTLET_ALREADY_ACTIVATED = 4013, // (undocumented) OUTLET_NOT_ACTIVATED = 4012, // (undocumented) ROOT_SEGMENT_MATRIX_PARAMS = 4003, // (undocumented) TWO_SEGMENTS_WITH_SAME_OUTLET = 4006, // (undocumented) UNEXPECTED_VALUE_IN_URL = 4011, // (undocumented) UNPARSABLE_URL = 4010 } // (No @packageDocumentation comment for this package) ```
{ "end_byte": 1255, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/errors.api.md" }
angular/goldens/public-api/router/upgrade/index.api.md_0_724
## API Report File for "@angular/router_upgrade" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { ComponentRef } from '@angular/core'; import { InjectionToken } from '@angular/core'; import { UpgradeModule } from '@angular/upgrade/static'; // @public export const RouterUpgradeInitializer: { provide: InjectionToken<readonly ((compRef: ComponentRef<any>) => void)[]>; multi: boolean; useFactory: (ngUpgrade: UpgradeModule) => () => void; deps: (typeof UpgradeModule)[]; }; // @public export function setUpLocationSync(ngUpgrade: UpgradeModule, urlType?: 'path' | 'hash'): void; // (No @packageDocumentation comment for this package) ```
{ "end_byte": 724, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/upgrade/index.api.md" }
angular/goldens/public-api/router/testing/index.api.md_0_1611
## API Report File for "@angular/router_testing" > Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). ```ts import { ComponentFixture } from '@angular/core/testing'; import { DebugElement } from '@angular/core'; import { ExtraOptions } from '@angular/router'; import * as i0 from '@angular/core'; import * as i1 from '@angular/router'; import { ModuleWithProviders } from '@angular/core'; import { Routes } from '@angular/router'; import { Type } from '@angular/core'; import { WritableSignal } from '@angular/core'; // @public export class RouterTestingHarness { static create(initialUrl?: string): Promise<RouterTestingHarness>; detectChanges(): void; readonly fixture: ComponentFixture<{ routerOutletData: WritableSignal<unknown>; }>; navigateByUrl(url: string): Promise<null | {}>; navigateByUrl<T>(url: string, requiredRoutedComponentType: Type<T>): Promise<T>; get routeDebugElement(): DebugElement | null; get routeNativeElement(): HTMLElement | null; } // @public @deprecated export class RouterTestingModule { // (undocumented) static withRoutes(routes: Routes, config?: ExtraOptions): ModuleWithProviders<RouterTestingModule>; // (undocumented) static ɵfac: i0.ɵɵFactoryDeclaration<RouterTestingModule, never>; // (undocumented) static ɵinj: i0.ɵɵInjectorDeclaration<RouterTestingModule>; // (undocumented) static ɵmod: i0.ɵɵNgModuleDeclaration<RouterTestingModule, never, never, [typeof i1.RouterModule]>; } // (No @packageDocumentation comment for this package) ```
{ "end_byte": 1611, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/goldens/public-api/router/testing/index.api.md" }
angular/modules/types.d.ts_0_492
/** * @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 */ // This file contains all ambient imports needed to compile the modules/ source code /// <reference types="hammerjs" /> /// <reference types="jasmine" /> /// <reference types="jasminewd2" /> /// <reference types="node" /> /// <reference types="zone.js" /> /// <reference lib="es2015" />
{ "end_byte": 492, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/types.d.ts" }
angular/modules/empty.ts_0_389
/** * @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 */ // This file intentionally left blank. It is used to load nothing in some cases. // Such as parse5/index is redirected here instead of loading into browser. export let __empty__: any;
{ "end_byte": 389, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/empty.ts" }
angular/modules/playground/README.md_0_363
## How to serve the examples All playground examples are built and served with Bazel. Below is an example that demonstrates how a specific example can be built and served with Bazel: ```bash # e.g. src/zippy_component yarn bazel run modules/playground/src/zippy_component:devserver # e.g. src/upgrade yarn bazel run modules/playground/src/upgrade:devserver ```
{ "end_byte": 363, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/README.md" }
angular/modules/playground/BUILD.bazel_0_71
exports_files([ "tsconfig-build.json", "tsconfig-e2e.json", ])
{ "end_byte": 71, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/BUILD.bazel" }
angular/modules/playground/e2e_test/example_test.bzl_0_1272
load("//tools:defaults.bzl", "protractor_web_test_suite", "ts_library") def example_test(name, srcs, server, data = [], deps = [], use_legacy_webdriver_types = True, **kwargs): ts_deps = [ "@npm//@angular/build-tooling/bazel/benchmark/driver-utilities", "//packages/private/testing", "@npm//@types/selenium-webdriver", "@npm//protractor", ] + deps # Reliance on the Control Flow in Selenium Webdriver is not recommended long-term, # especially with the deprecation of Protractor. New tests should not use the legacy # webdriver types but rather use the actual `@types/jasmine` types. if use_legacy_webdriver_types: ts_deps.append("@npm//@types/jasminewd2") ts_library( name = "%s_lib" % name, testonly = True, srcs = srcs, tsconfig = "//modules/playground:tsconfig-e2e.json", deps = ts_deps, ) protractor_web_test_suite( name = "protractor_tests", data = data, on_prepare = "//modules/playground/e2e_test:start-server.js", server = server, deps = [ ":%s_lib" % name, "@npm//selenium-webdriver", "@npm//yargs", "@npm//source-map", ], **kwargs )
{ "end_byte": 1272, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/example_test.bzl" }
angular/modules/playground/e2e_test/start-server.js_0_552
/** * @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 */ const protractorUtils = require('@bazel/protractor/protractor-utils'); const protractor = require('protractor'); module.exports = async function (config) { const {port} = await protractorUtils.runServer(config.workspace, config.server, '--port', []); const serverUrl = `http://localhost:${port}`; protractor.browser.baseUrl = serverUrl; };
{ "end_byte": 552, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/start-server.js" }
angular/modules/playground/e2e_test/BUILD.bazel_0_35
exports_files(["start-server.js"])
{ "end_byte": 35, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/BUILD.bazel" }
angular/modules/playground/e2e_test/svg/svg_spec.ts_0_661
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser, by, element} from 'protractor'; describe('SVG', function () { const URL = '/'; afterEach(verifyNoBrowserErrors); beforeEach(() => { browser.get(URL); }); it('should display SVG component contents', function () { const svgText = element.all(by.css('g text')).get(0); expect(svgText.getText()).toEqual('Hello'); }); });
{ "end_byte": 661, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/svg/svg_spec.ts" }
angular/modules/playground/e2e_test/svg/BUILD.bazel_0_191
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "svg", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/svg:devserver", )
{ "end_byte": 191, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/svg/BUILD.bazel" }
angular/modules/playground/e2e_test/upgrade/upgrade_spec.ts_0_1087
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser, by, element} from 'protractor'; describe('ngUpgrade', function () { const URL = '/'; beforeEach(function () { browser.rootEl = 'body'; browser.get(URL); }); afterEach(function () { browser.useAllAngular2AppRoots(); verifyNoBrowserErrors(); }); it('should bootstrap AngularJS and Angular apps together', function () { const ng1NameInput = element(by.css('input[ng-model="name"]')); expect(ng1NameInput.getAttribute('value')).toEqual('World'); const projectedGreetingEl = element(by.css('.projected-content .greeting')); const upgradedNg1ComponentEl = element(by.css('ng1-user')); expect(projectedGreetingEl.getText()).toMatch(/World!$/); expect(upgradedNg1ComponentEl.getText()).toMatch(/^User: World/); }); });
{ "end_byte": 1087, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/upgrade/upgrade_spec.ts" }
angular/modules/playground/e2e_test/upgrade/BUILD.bazel_0_199
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "upgrade", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/upgrade:devserver", )
{ "end_byte": 199, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/upgrade/BUILD.bazel" }
angular/modules/playground/e2e_test/sourcemap/sourcemap_spec.ts_0_1710
/** * @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 {runfiles} from '@bazel/runfiles'; import {readFileSync} from 'fs'; import {$, browser} from 'protractor'; import {logging} from 'selenium-webdriver'; import {RawSourceMap, SourceMapConsumer} from 'source-map'; describe('sourcemaps', function () { const URL = '/'; it('should map sources', async function () { await browser.get(URL); await $('error-app .errorButton').click(); const logs = await browser.manage().logs().get(logging.Type.BROWSER); let errorLine: number | null = null; let errorColumn: number | null = null; logs.forEach(function (log: any) { const match = log.message.match(/\.createError\s+\(.+:(\d+):(\d+)/m); if (match) { errorLine = parseInt(match[1]); errorColumn = parseInt(match[2]); } }); expect(errorLine).not.toBeNull(); expect(errorColumn).not.toBeNull(); const mapContent = readFileSync( runfiles.resolvePackageRelative('../../src/sourcemap/app_bundle.js.map'), ).toString('utf8'); const decoder = await new SourceMapConsumer(JSON.parse(mapContent) as RawSourceMap); const originalPosition = decoder.originalPositionFor({line: errorLine!, column: errorColumn!}); const sourceCodeLines = readFileSync( runfiles.resolvePackageRelative('../../src/sourcemap/index.ts'), { encoding: 'utf-8', }, ).split('\n'); expect(sourceCodeLines[originalPosition.line! - 1]).toMatch( /throw new Error\(\'Sourcemap test\'\)/, ); }); });
{ "end_byte": 1710, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/sourcemap/sourcemap_spec.ts" }
angular/modules/playground/e2e_test/sourcemap/BUILD.bazel_0_579
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "sourcemap", srcs = glob(["**/*.ts"]), data = [ "//modules/playground/src/sourcemap:app_bundle", "//modules/playground/src/sourcemap:index.ts", "@npm//source-map", ], # Source-Map is using WASM and cannot be bundled for specs. external = ["source-map"], server = "//modules/playground/src/sourcemap:devserver", use_legacy_webdriver_types = False, deps = [ "@npm//@bazel/runfiles", "@npm//source-map", ], )
{ "end_byte": 579, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/sourcemap/BUILD.bazel" }
angular/modules/playground/e2e_test/hello_world/hello_world_spec.ts_0_1274
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser} from 'protractor'; describe('hello world', function () { afterEach(verifyNoBrowserErrors); describe('hello world app', function () { const URL = '/'; it('should greet', function () { browser.get(URL); expect(getComponentText('hello-app', '.greeting')).toEqual('hello world!'); }); it('should change greeting', function () { browser.get(URL); clickComponentButton('hello-app', '.changeButton'); expect(getComponentText('hello-app', '.greeting')).toEqual('howdy world!'); }); }); }); function getComponentText(selector: string, innerSelector: string) { return browser.executeScript( `return document.querySelector("${selector}").querySelector("${innerSelector}").textContent`, ); } function clickComponentButton(selector: string, innerSelector: string) { return browser.executeScript( `return document.querySelector("${selector}").querySelector("${innerSelector}").click()`, ); }
{ "end_byte": 1274, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/hello_world/hello_world_spec.ts" }
angular/modules/playground/e2e_test/hello_world/BUILD.bazel_0_207
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "hello_world", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/hello_world:devserver", )
{ "end_byte": 207, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/hello_world/BUILD.bazel" }
angular/modules/playground/e2e_test/order_management/order_management_spec.ts_0_499
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser} from 'protractor'; describe('Order Management CRUD', function () { const URL = '/'; it('should work', function () { browser.get(URL); verifyNoBrowserErrors(); }); });
{ "end_byte": 499, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/order_management/order_management_spec.ts" }
angular/modules/playground/e2e_test/order_management/BUILD.bazel_0_217
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "order_management", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/order_management:devserver", )
{ "end_byte": 217, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/order_management/BUILD.bazel" }
angular/modules/playground/e2e_test/model_driven_forms/BUILD.bazel_0_221
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "model_driven_forms", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/model_driven_forms:devserver", )
{ "end_byte": 221, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/model_driven_forms/BUILD.bazel" }
angular/modules/playground/e2e_test/model_driven_forms/model_driven_forms_spec.ts_0_852
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser, by, element} from 'protractor'; describe('Model-Driven Forms', function () { afterEach(verifyNoBrowserErrors); const URL = '/'; it('should display errors', function () { browser.get(URL); const form = element.all(by.css('form')).first(); const input = element.all(by.css('#creditCard')).first(); const firstName = element.all(by.css('#firstName')).first(); input.sendKeys('invalid'); firstName.click(); expect(form.getAttribute('innerHTML')).toContain('is invalid credit card number'); }); });
{ "end_byte": 852, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/model_driven_forms/model_driven_forms_spec.ts" }
angular/modules/playground/e2e_test/async/BUILD.bazel_0_195
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "async", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/async:devserver", )
{ "end_byte": 195, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/async/BUILD.bazel" }
angular/modules/playground/e2e_test/async/async_spec.ts_0_3180
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {$, browser} from 'protractor'; import {promise} from 'selenium-webdriver'; describe('async', () => { const URL = '/'; beforeEach(() => browser.get(URL)); it('should work with synchronous actions', () => { const increment = $('#increment'); increment.$('.action').click(); expect(increment.$('.val').getText()).toEqual('1'); }); it('should wait for asynchronous actions', () => { const timeout = $('#delayedIncrement'); // At this point, the async action is still pending, so the count should // still be 0. expect(timeout.$('.val').getText()).toEqual('0'); timeout.$('.action').click(); // whenStable should only be called when the async action finished, // so the count should be 1 at this point. expect(timeout.$('.val').getText()).toEqual('1'); }); it('should notice when asynchronous actions are cancelled', () => { const timeout = $('#delayedIncrement'); // At this point, the async action is still pending, so the count should // still be 0. expect(timeout.$('.val').getText()).toEqual('0'); browser.ignoreSynchronization = true; timeout.$('.action').click(); timeout.$('.cancel').click(); browser.ignoreSynchronization = false; // whenStable should be called since the async action is cancelled. The // count should still be 0; expect(timeout.$('.val').getText()).toEqual('0'); }); it('should wait for a series of asynchronous actions', () => { const timeout = $('#multiDelayedIncrements'); // At this point, the async action is still pending, so the count should // still be 0. expect(timeout.$('.val').getText()).toEqual('0'); timeout.$('.action').click(); // whenStable should only be called when all the async actions // finished, so the count should be 10 at this point. expect(timeout.$('.val').getText()).toEqual('10'); }); it('should wait via frameworkStabilizer', () => { const whenAllStable = (): promise.Promise<any> => { return browser.executeAsyncScript('window.frameworkStabilizers[0](arguments[0]);'); }; // This disables protractor's wait mechanism browser.ignoreSynchronization = true; const timeout = $('#multiDelayedIncrements'); // At this point, the async action is still pending, so the count should // still be 0. expect(timeout.$('.val').getText()).toEqual('0'); timeout.$('.action').click(); whenAllStable().then(() => { // whenAllStable should only be called when all the async actions // finished, so the count should be 10 at this point. expect(timeout.$('.val').getText()).toEqual('10'); }); whenAllStable().then(() => { // whenAllStable should be called immediately since nothing is pending. browser.ignoreSynchronization = false; }); }); afterEach(verifyNoBrowserErrors); });
{ "end_byte": 3180, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/async/async_spec.ts" }
angular/modules/playground/e2e_test/key_events/key_events_spec.ts_0_2837
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser, by, element, protractor} from 'protractor'; const Key = protractor.Key; describe('key_events', function () { const URL = '/'; afterEach(verifyNoBrowserErrors); beforeEach(() => { browser.get(URL); }); it('should display correct key names', function () { const firstArea = element.all(by.css('.sample-area')).get(0); expect(firstArea.getText()).toEqual('(none)'); // testing different key categories: firstArea.sendKeys(Key.ENTER); expect(firstArea.getText()).toEqual('enter'); firstArea.sendKeys(Key.SHIFT, Key.ENTER); expect(firstArea.getText()).toEqual('shift.enter'); firstArea.sendKeys(Key.CONTROL, Key.SHIFT, Key.ENTER); expect(firstArea.getText()).toEqual('control.shift.enter'); firstArea.sendKeys(' '); expect(firstArea.getText()).toEqual('space'); // It would not work with a letter which position depends on the keyboard layout (ie AZERTY vs // QWERTY), see https://code.google.com/p/chromedriver/issues/detail?id=553 firstArea.sendKeys('u'); expect(firstArea.getText()).toEqual('u'); firstArea.sendKeys(Key.CONTROL, 'b'); expect(firstArea.getText()).toEqual('control.b'); firstArea.sendKeys(Key.F1); expect(firstArea.getText()).toEqual('f1'); firstArea.sendKeys(Key.ALT, Key.F1); expect(firstArea.getText()).toEqual('alt.f1'); firstArea.sendKeys(Key.CONTROL, Key.F1); expect(firstArea.getText()).toEqual('control.f1'); // There is an issue with Key.NUMPAD0 (and other NUMPADx): // chromedriver does not correctly set the location property on the event to // specify that the key is on the numeric keypad (event.location = 3) // so the following test fails: // firstArea.sendKeys(Key.NUMPAD0); // expect(firstArea.getText()).toEqual('0'); }); it('should correctly react to the specified key', function () { const secondArea = element.all(by.css('.sample-area')).get(1); secondArea.sendKeys(Key.SHIFT, Key.ENTER); expect(secondArea.getText()).toEqual('You pressed shift.enter!'); }); it('should not react to incomplete keys', function () { const secondArea = element.all(by.css('.sample-area')).get(1); secondArea.sendKeys(Key.ENTER); expect(secondArea.getText()).toEqual(''); }); it('should not react to keys with more modifiers', function () { const secondArea = element.all(by.css('.sample-area')).get(1); secondArea.sendKeys(Key.CONTROL, Key.SHIFT, Key.ENTER); expect(secondArea.getText()).toEqual(''); }); });
{ "end_byte": 2837, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/key_events/key_events_spec.ts" }
angular/modules/playground/e2e_test/key_events/BUILD.bazel_0_205
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "key_events", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/key_events:devserver", )
{ "end_byte": 205, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/key_events/BUILD.bazel" }
angular/modules/playground/e2e_test/person_management/person_management_spec.ts_0_500
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser} from 'protractor'; describe('Person Management CRUD', function () { const URL = '/'; it('should work', function () { browser.get(URL); verifyNoBrowserErrors(); }); });
{ "end_byte": 500, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/person_management/person_management_spec.ts" }
angular/modules/playground/e2e_test/person_management/BUILD.bazel_0_219
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "person_management", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/person_management:devserver", )
{ "end_byte": 219, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/person_management/BUILD.bazel" }
angular/modules/playground/e2e_test/zippy_component/BUILD.bazel_0_215
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "zippy_component", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/zippy_component:devserver", )
{ "end_byte": 215, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/zippy_component/BUILD.bazel" }
angular/modules/playground/e2e_test/zippy_component/zippy_spec.ts_0_1330
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser, by, element} from 'protractor'; describe('Zippy Component', function () { afterEach(verifyNoBrowserErrors); describe('zippy', function () { const URL = '/'; beforeEach(function () { browser.get(URL); }); it("should change the zippy title depending on it's state", function () { const zippyTitle = element(by.css('.zippy__title')); expect(zippyTitle.getText()).toEqual('▾ Details'); zippyTitle.click(); expect(zippyTitle.getText()).toEqual('▸ Details'); }); it('should have zippy content', function () { expect(element(by.css('.zippy__content')).getText()).toEqual('This is some content.'); }); it('should toggle when the zippy title is clicked', function () { element(by.css('.zippy__title')).click(); expect(element(by.css('.zippy__content')).isDisplayed()).toEqual(false); element(by.css('.zippy__title')).click(); expect(element(by.css('.zippy__content')).isDisplayed()).toEqual(true); }); }); });
{ "end_byte": 1330, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/zippy_component/zippy_spec.ts" }
angular/modules/playground/e2e_test/http/BUILD.bazel_0_193
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "http", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/http:devserver", )
{ "end_byte": 193, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/http/BUILD.bazel" }
angular/modules/playground/e2e_test/http/http_spec.ts_0_853
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser} from 'protractor'; describe('http', function () { afterEach(verifyNoBrowserErrors); describe('fetching', function () { const URL = '/'; it('should fetch and display people', function () { browser.get(URL); expect(getComponentText('http-app', '.people')).toEqual('hello, Jeff'); }); }); }); function getComponentText(selector: string, innerSelector: string) { return browser.executeScript( `return document.querySelector("${selector}").querySelector("${innerSelector}").textContent.trim()`, ); }
{ "end_byte": 853, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/http/http_spec.ts" }
angular/modules/playground/e2e_test/template_driven_forms/template_driven_forms_spec.ts_0_855
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser, by, element} from 'protractor'; describe('Template-Driven Forms', function () { afterEach(verifyNoBrowserErrors); const URL = '/'; it('should display errors', function () { browser.get(URL); const form = element.all(by.css('form')).first(); const input = element.all(by.css('#creditCard')).first(); const firstName = element.all(by.css('#firstName')).first(); input.sendKeys('invalid'); firstName.click(); expect(form.getAttribute('innerHTML')).toContain('is invalid credit card number'); }); });
{ "end_byte": 855, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/template_driven_forms/template_driven_forms_spec.ts" }
angular/modules/playground/e2e_test/template_driven_forms/BUILD.bazel_0_227
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "template_driven_forms", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/template_driven_forms:devserver", )
{ "end_byte": 227, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/template_driven_forms/BUILD.bazel" }
angular/modules/playground/e2e_test/jsonp/jsonp_spec.ts_0_856
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {browser} from 'protractor'; describe('jsonp', function () { afterEach(verifyNoBrowserErrors); describe('fetching', function () { const URL = '/'; it('should fetch and display people', function () { browser.get(URL); expect(getComponentText('jsonp-app', '.people')).toEqual('hello, caitp'); }); }); }); function getComponentText(selector: string, innerSelector: string) { return browser.executeScript( `return document.querySelector("${selector}").querySelector("${innerSelector}").textContent.trim()`, ); }
{ "end_byte": 856, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/jsonp/jsonp_spec.ts" }
angular/modules/playground/e2e_test/jsonp/BUILD.bazel_0_195
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "jsonp", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/jsonp:devserver", )
{ "end_byte": 195, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/jsonp/BUILD.bazel" }
angular/modules/playground/e2e_test/routing/routing_spec.ts_0_913
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {$, browser, by, element, ExpectedConditions} from 'protractor'; function waitForElement(selector: string) { // Waits for the element with id 'abc' to be present on the dom. browser.wait(ExpectedConditions.presenceOf($(selector)), 20000); } describe('routing inbox-app', () => { afterEach(verifyNoBrowserErrors); describe('index view', () => { const URL = '/'; it('should list out the current collection of items', () => { browser.get(URL); waitForElement('.inbox-item-record'); expect(element.all(by.css('.inbox-item-record')).count()).toEqual(200); }); }); });
{ "end_byte": 913, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/routing/routing_spec.ts" }
angular/modules/playground/e2e_test/routing/BUILD.bazel_0_199
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "routing", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/routing:devserver", )
{ "end_byte": 199, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/routing/BUILD.bazel" }
angular/modules/playground/e2e_test/relative_assets/assets_spec.ts_0_1286
/** * @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 {verifyNoBrowserErrors} from '@angular/build-tooling/bazel/benchmark/driver-utilities'; import {$, browser, by, element, ExpectedConditions} from 'protractor'; function waitForElement(selector: string) { // Waits for the element with id 'abc' to be present on the dom. browser.wait(ExpectedConditions.presenceOf($(selector)), 20000); } describe('relative assets relative-app', () => { afterEach(verifyNoBrowserErrors); const URL = '/'; it('should load in the templateUrl relative to the my-cmp component', () => { browser.get(URL); waitForElement('my-cmp .inner-container'); expect(element.all(by.css('my-cmp .inner-container')).count()).toEqual(1); }); it('should load in the styleUrls relative to the my-cmp component', () => { browser.get(URL); waitForElement('my-cmp .inner-container'); const elem = element(by.css('my-cmp .inner-container')); const width = browser.executeScript( (e: Element) => parseInt(window.getComputedStyle(e).width), elem.getWebElement(), ); expect(width).toBe(432); }); });
{ "end_byte": 1286, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/relative_assets/assets_spec.ts" }
angular/modules/playground/e2e_test/relative_assets/BUILD.bazel_0_215
load("//modules/playground/e2e_test:example_test.bzl", "example_test") example_test( name = "relative_assets", srcs = glob(["**/*.ts"]), server = "//modules/playground/src/relative_assets:devserver", )
{ "end_byte": 215, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/e2e_test/relative_assets/BUILD.bazel" }
angular/modules/playground/src/svg/index.html_0_225
<!DOCTYPE html> <html> <title>SVG</title> <body> <svg-app> Loading... </svg-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 225, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/svg/index.html" }
angular/modules/playground/src/svg/BUILD.bazel_0_649
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "svg", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":svg"], ) http_server( name = "devserver", srcs = ["index.html"], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 649, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/svg/BUILD.bazel" }
angular/modules/playground/src/svg/index.ts_0_850
/** * @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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; @Component({ selector: '[svg-group]', template: `<svg:text x="20" y="20">Hello</svg:text>`, standalone: false, }) export class SvgGroup {} @Component({ selector: 'svg-app', template: `<svg> <g svg-group></g> </svg>`, standalone: false, }) export class SvgApp {} @NgModule({bootstrap: [SvgApp], declarations: [SvgApp, SvgGroup], imports: [BrowserModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 850, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/svg/index.ts" }
angular/modules/playground/src/animate/index.html_0_486
<!DOCTYPE html> <html> <title>Animation Example</title> <link rel="stylesheet" type="text/css" href="./css/animate-app.css" /> <style> animate-app { display: block; position: fixed; top: 0; left: 0; right: 0; bottom: 0; padding: 50px; } </style> <body> <animate-app>Loading...</animate-app> </body> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </html>
{ "end_byte": 486, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/animate/index.html" }
angular/modules/playground/src/animate/BUILD.bazel_0_780
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "animate", srcs = glob(["**/*.ts"]), assets = glob(["**/*.css"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/animations", "//packages/core", "//packages/platform-browser-dynamic", "//packages/platform-browser/animations", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":animate"], ) http_server( name = "devserver", srcs = [ "css/animate-app.css", "index.html", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 780, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/animate/BUILD.bazel" }
angular/modules/playground/src/animate/index.ts_0_632
/** * @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 {NgModule} from '@angular/core'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; import {AnimateApp} from './app/animate-app'; @NgModule({declarations: [AnimateApp], bootstrap: [AnimateApp], imports: [BrowserAnimationsModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 632, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/animate/index.ts" }
angular/modules/playground/src/animate/app/animate-app.ts_0_3516
/** * @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, keyframes, state, style, transition, trigger} from '@angular/animations'; import {Component} from '@angular/core'; @Component({ host: { '[@backgroundAnimation]': 'bgStatus', '(@backgroundAnimation.start)': 'bgStatusChanged($event, "started")', '(@backgroundAnimation.done)': 'bgStatusChanged($event, "completed")', }, selector: 'animate-app', styleUrls: ['../css/animate-app.css'], template: ` <button (click)="state = 'start'">Start State</button> <button (click)="state = 'active'">Active State</button> | <button (click)="state = 'void'">Void State</button> <button (click)="reorderAndRemove()">Scramble!</button> <button (click)="state = 'default'">Unhandled (default) State</button> <button style="float:right" (click)="bgStatus = 'blur'">Blur Page (Host)</button> <hr /> <div *ngFor="let item of items; let i = index" class="box" [@boxAnimation]="state"> {{ item }} - {{ i }} <button (click)="remove(item)">x</button> </div> `, animations: [ trigger('backgroundAnimation', [ state('focus', style({'background-color': 'white'})), state('blur', style({'background-color': 'grey'})), transition('* => *', [animate(500)]), ]), trigger('boxAnimation', [ state('*', style({'height': '*', 'background-color': '#dddddd', 'color': 'black'})), state('void, hidden', style({'height': 0, 'opacity': 0})), state('start', style({'background-color': 'red', 'height': '*'})), state( 'active', style({'background-color': 'orange', 'color': 'white', 'font-size': '100px'}), ), transition('active <=> start', [ animate(500, style({'transform': 'scale(2)'})), animate(500), ]), transition('* => *', [ animate(1000, style({'opacity': 1, 'height': 300})), animate(1000, style({'background-color': 'blue'})), animate( 1000, keyframes([ style({'background-color': 'blue', 'color': 'black', 'offset': 0.2}), style({'background-color': 'brown', 'color': 'black', 'offset': 0.5}), style({'background-color': 'black', 'color': 'white', 'offset': 1}), ]), ), animate(2000), ]), ]), ], standalone: false, }) export class AnimateApp { public items: number[] = []; private _state: 'start' | 'active' | 'void' | 'default'; public bgStatus = 'focus'; remove(item: number) { const index = this.items.indexOf(item); if (index >= 0) { this.items.splice(index, 1); } } reorderAndRemove() { this.items = this.items.sort((a, b) => Math.random() - 0.5); this.items.splice(Math.floor(Math.random() * this.items.length), 1); this.items.splice(Math.floor(Math.random() * this.items.length), 1); this.items[Math.floor(Math.random() * this.items.length)] = 99; } bgStatusChanged(data: {[key: string]: string}, phase: string) { alert(`backgroundAnimation has ${phase} from ${data['fromState']} to ${data['toState']}`); } get state() { return this._state; } set state(s) { this._state = s; if (s == 'void') { this.items = []; } else { this.items = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20]; } } }
{ "end_byte": 3516, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/animate/app/animate-app.ts" }
angular/modules/playground/src/animate/css/animate-app.css_0_299
button { background:red; font-size:20px; color:white; border:0; cursor:pointer; } .box { font-size:40px; border:10px solid black; width:200px; line-height:100px; height:100px; display:inline-block; vertical-align:top; text-align:center; margin:5px; overflow:hidden; }
{ "end_byte": 299, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/animate/css/animate-app.css" }
angular/modules/playground/src/upgrade/index.html_0_736
<!DOCTYPE html> <html> <title>Angular Upgrade 2.0</title> <style> user { background-color: lightyellow; border: 2px solid darkorange; display: inline-block; width: 150px; padding: 1em; } </style> <body> <upgrade-app ng-controller="Index" [user]="name" (reset)="name=''"> Your name: <input ng-model="name" /> <hr /> <span class="greeting">Greetings from {{name}}!</span> </upgrade-app> <script src="/npm/node_modules/reflect-metadata/Reflect.js"></script> <script src="/npm/node_modules/angular-1.8/angular.js"></script> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 736, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/upgrade/index.html" }
angular/modules/playground/src/upgrade/BUILD.bazel_0_1004
load("//tools:defaults.bzl", "esbuild", "http_server", "ts_library") package(default_visibility = ["//modules/playground:__subpackages__"]) # Since this test uses the AOT-incompatible version of "@angular/upgrade", we cannot # use the "ng_module" rule here unless we switch this example to "upgrade/static". ts_library( name = "upgrade", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/upgrade", ], ) # Note: Not using `app_bundle` here because this example relies on JIT. esbuild( name = "app_bundle", entry_point = ":index.ts", deps = [":upgrade"], ) http_server( name = "devserver", srcs = [ "index.html", "@npm//:node_modules/angular-1.8/angular.js", "@npm//:node_modules/reflect-metadata/Reflect.js", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 1004, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/upgrade/BUILD.bazel" }
angular/modules/playground/src/upgrade/index.ts_0_2130
/** * @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, EventEmitter, forwardRef, Input, NgModule, Output} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {UpgradeAdapter} from '@angular/upgrade'; declare const angular: any; const styles = [ ` .border { border: solid 2px DodgerBlue; } .title { background-color: LightSkyBlue; padding: .2em 1em; font-size: 1.2em; } .content { padding: 1em; } `, ]; const adapter = new UpgradeAdapter(forwardRef(() => Ng2AppModule)); const ng1module = angular.module('myExample', []); ng1module.controller('Index', function ($scope: any) { $scope.name = 'World'; }); ng1module.directive('ng1User', function () { return { scope: {handle: '@', reset: '&'}, template: ` User: {{handle}} <hr> <button ng-click="reset()">clear</button>`, }; }); @Component({ selector: 'pane', template: `<div class="border"> <div class="title">{{ title }}</div> <div class="content"><ng-content></ng-content></div> </div>`, styles: styles, standalone: false, }) export class Pane { @Input() title: string; } @Component({ selector: 'upgrade-app', template: `<div class="border"> <pane title="Title: {{ user }}"> <table cellpadding="3"> <tr> <td class="projected-content"><ng-content></ng-content></td> <td><ng1-user [handle]="user" (reset)="reset.emit()"></ng1-user></td> </tr> </table> </pane> </div>`, styles: styles, standalone: false, }) export class UpgradeApp { @Input() user: string; @Output() reset = new EventEmitter(); constructor() {} } @NgModule({ declarations: [Pane, UpgradeApp, adapter.upgradeNg1Component('ng1User')], imports: [BrowserModule], }) export class Ng2AppModule {} ng1module.directive('upgradeApp', adapter.downgradeNg2Component(UpgradeApp)); adapter.bootstrap(document.body, ['myExample']);
{ "end_byte": 2130, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/upgrade/index.ts" }
angular/modules/playground/src/sourcemap/index.html_0_338
<!DOCTYPE html> <html> <title>Sourcemaps</title> <body> <error-app> Loading... </error-app> <p>Please look into the console and check whether the stack trace is mapped via source maps!</p> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 338, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/sourcemap/index.html" }
angular/modules/playground/src/sourcemap/BUILD.bazel_0_830
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) # Exported since the e2e test needs to read the source file in order to # ensure that the source map properly maps back to the source file. exports_files(["index.ts"]) ng_module( name = "sourcemap", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":sourcemap"], ) http_server( name = "devserver", srcs = ["index.html"], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 830, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/sourcemap/BUILD.bazel" }
angular/modules/playground/src/sourcemap/index.ts_0_826
/** * @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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; @Component({ selector: 'error-app', template: ` <button class="errorButton" (click)="createError()">create error</button>`, standalone: false, }) export class ErrorComponent { createError(): void { throw new Error('Sourcemap test'); } } @NgModule({declarations: [ErrorComponent], bootstrap: [ErrorComponent], imports: [BrowserModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 826, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/sourcemap/index.ts" }
angular/modules/playground/src/hello_world/index.html_0_239
<!DOCTYPE html> <html> <title>Hello Angular</title> <body> <hello-app> Loading... </hello-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 239, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/hello_world/index.html" }
angular/modules/playground/src/hello_world/BUILD.bazel_0_680
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "hello_world", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":hello_world"], ) http_server( name = "devserver", srcs = [ "index.html", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 680, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/hello_world/BUILD.bazel" }
angular/modules/playground/src/hello_world/index.ts_0_2331
/** * @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, ElementRef, Injectable, NgModule, Renderer2} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; // A service available to the Injector, used by the HelloCmp component. @Injectable() export class GreetingService { greeting: string = 'hello'; } // Directives are light-weight. They don't allow new // expression contexts (use @Component for those needs). @Directive({ selector: '[red]', standalone: false, }) export class RedDec { // ElementRef is always injectable and it wraps the element on which the // directive was found by the compiler. constructor(el: ElementRef, renderer: Renderer2) { renderer.setStyle(el.nativeElement, 'color', 'red'); } } // Angular supports 2 basic types of directives: // - Component - the basic building blocks of Angular apps. Backed by // ShadowDom. (https://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/) // - Directive - add behavior to existing elements. @Component({ // The Selector prop tells Angular on which elements to instantiate this // class. The syntax supported is a basic subset of CSS selectors, for example // 'element', '[attr]', [attr=foo]', etc. selector: 'hello-app', // These are services that would be created if a class in the component's // template tries to inject them. viewProviders: [GreetingService], // Expressions in the template (like {{greeting}}) are evaluated in the // context of the HelloCmp class below. template: `<div class="greeting">{{ greeting }} <span red>world</span>!</div> <button class="changeButton" (click)="changeGreeting()">change greeting</button>`, standalone: false, }) export class HelloCmp { greeting: string; constructor(service: GreetingService) { this.greeting = service.greeting; } changeGreeting(): void { this.greeting = 'howdy'; } } @NgModule({declarations: [HelloCmp, RedDec], bootstrap: [HelloCmp], imports: [BrowserModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 2331, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/hello_world/index.ts" }
angular/modules/playground/src/order_management/index.html_0_370
<!DOCTYPE html> <html> <head> <title>Order Management</title> <style> .warning { background-color: yellow; } </style> </head> <body> <order-management-app> Loading... </order-management-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 370, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/order_management/index.html" }
angular/modules/playground/src/order_management/BUILD.bazel_0_718
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "order_management", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/forms", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":order_management"], ) http_server( name = "devserver", srcs = [ "index.html", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 718, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/order_management/BUILD.bazel" }
angular/modules/playground/src/order_management/index.ts_0_5776
/** * @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, EventEmitter, Injectable, Input, NgModule, Output} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; /** * You can find the AngularJS implementation of this example here: * https://github.com/wardbell/ng1DataBinding */ // ---- model class OrderItem { constructor( public orderItemId: number, public orderId: number, public productName: string, public qty: number, public unitPrice: number, ) {} get total(): number { return this.qty * this.unitPrice; } } class Order { constructor( public orderId: number, public customerName: string, public limit: number, private _dataService: DataService, ) {} get items(): OrderItem[] { return this._dataService.itemsFor(this); } get total(): number { return this.items.map((i) => i.total).reduce((a, b) => a + b, 0); } } // ---- services let _nextId = 1000; @Injectable() export class DataService { orderItems: OrderItem[]; orders: Order[]; currentOrder: Order = null; constructor() { this.orders = [ new Order(_nextId++, 'J. Coltrane', 100, this), new Order(_nextId++, 'B. Evans', 200, this), ]; this.orderItems = [ new OrderItem(_nextId++, this.orders[0].orderId, 'Bread', 5, 1), new OrderItem(_nextId++, this.orders[0].orderId, 'Brie', 5, 2), new OrderItem(_nextId++, this.orders[0].orderId, 'IPA', 5, 3), new OrderItem(_nextId++, this.orders[1].orderId, 'Mozzarella', 5, 2), new OrderItem(_nextId++, this.orders[1].orderId, 'Wine', 5, 3), ]; } itemsFor(order: Order): OrderItem[] { return this.orderItems.filter((i) => i.orderId === order.orderId); } addItemForOrder(order: Order): void { this.orderItems.push(new OrderItem(_nextId++, order.orderId, '', 0, 0)); } deleteItem(item: OrderItem): void { this.orderItems.splice(this.orderItems.indexOf(item), 1); } } // ---- components @Component({ selector: 'order-list-cmp', template: ` <h1>Orders</h1> <div *ngFor="let order of orders" [class.warning]="order.total > order.limit"> <div> <label>Customer name:</label> {{ order.customerName }} </div> <div> <label>Limit: <input [(ngModel)]="order.limit" type="number" placeholder="Limit" /></label> </div> <div> <label>Number of items:</label> {{ order.items.length }} </div> <div> <label>Order total:</label> {{ order.total }} </div> <button (click)="select(order)">Select</button> </div> `, standalone: false, }) export class OrderListComponent { orders: Order[]; constructor(private _service: DataService) { this.orders = _service.orders; } select(order: Order): void { this._service.currentOrder = order; } } @Component({ selector: 'order-item-cmp', template: ` <div> <div> <label >Product name: <input [(ngModel)]="item.productName" type="text" placeholder="Product name" /></label> </div> <div> <label >Quantity: <input [(ngModel)]="item.qty" type="number" placeholder="Quantity" /></label> </div> <div> <label >Unit Price: <input [(ngModel)]="item.unitPrice" type="number" placeholder="Unit price" /></label> </div> <div> <label>Total:</label> {{ item.total }} </div> <button (click)="onDelete()">Delete</button> </div> `, standalone: false, }) export class OrderItemComponent { @Input() item: OrderItem; @Output() delete = new EventEmitter(); onDelete(): void { this.delete.emit(this.item); } } @Component({ selector: 'order-details-cmp', template: ` <div *ngIf="order !== null"> <h1>Selected Order</h1> <div> <label >Customer name: <input [(ngModel)]="order.customerName" type="text" placeholder="Customer name" /></label> </div> <div> <label>Limit: <input [(ngModel)]="order.limit" type="number" placeholder="Limit" /></label> </div> <div> <label>Number of items:</label> {{ order.items.length }} </div> <div> <label>Order total:</label> {{ order.total }} </div> <h2>Items</h2> <button (click)="addItem()">Add Item</button> <order-item-cmp *ngFor="let item of order.items" [item]="item" (delete)="deleteItem(item)" ></order-item-cmp> </div> `, standalone: false, }) export class OrderDetailsComponent { constructor(private _service: DataService) {} get order(): Order { return this._service.currentOrder; } deleteItem(item: OrderItem): void { this._service.deleteItem(item); } addItem(): void { this._service.addItemForOrder(this.order); } } @Component({ selector: 'order-management-app', providers: [DataService], template: ` <order-list-cmp></order-list-cmp> <order-details-cmp></order-details-cmp> `, standalone: false, }) export class OrderManagementApplication {} @NgModule({ bootstrap: [OrderManagementApplication], declarations: [ OrderManagementApplication, OrderListComponent, OrderDetailsComponent, OrderItemComponent, ], imports: [BrowserModule, FormsModule], }) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 5776, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/order_management/index.ts" }
angular/modules/playground/src/model_driven_forms/index.html_0_367
<!DOCTYPE html> <html> <head> <title>Model Driven Forms</title> <style> .ng-touched.ng-invalid { border-color: red; } </style> </head> <body> <reactive-forms> Loading... </reactive-forms> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 367, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/model_driven_forms/index.html" }
angular/modules/playground/src/model_driven_forms/BUILD.bazel_0_722
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "model_driven_forms", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/forms", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":model_driven_forms"], ) http_server( name = "devserver", srcs = [ "index.html", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 722, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/model_driven_forms/BUILD.bazel" }
angular/modules/playground/src/model_driven_forms/index.ts_0_5117
/** * @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:no-console */ import {Component, Host, NgModule} from '@angular/core'; import { AbstractControl, FormBuilder, FormGroup, FormGroupDirective, ReactiveFormsModule, UntypedFormBuilder, UntypedFormGroup, Validators, } from '@angular/forms'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; /** * Custom validator. */ function creditCardValidator(c: AbstractControl): {[key: string]: boolean} { if (c.value && /^\d{16}$/.test(c.value)) { return null; } else { return {'invalidCreditCard': true}; } } /** * This is a component that displays an error message. * * For instance, * * <show-error control="creditCard" [errors]="['required', 'invalidCreditCard']"></show-error> * * Will display the "is required" error if the control is empty, and "invalid credit card" if the * control is not empty * but not valid. * * In a real application, this component would receive a service that would map an error code to an * actual error message. * To make it simple, we are using a simple map here. */ @Component({ selector: 'show-error', inputs: ['controlPath: control', 'errorTypes: errors'], template: ` <span *ngIf="errorMessage !== null">{{ errorMessage }}</span> `, standalone: false, }) export class ShowError { formDir: FormGroupDirective; controlPath: string; errorTypes: string[]; constructor(@Host() formDir: FormGroupDirective) { this.formDir = formDir; } get errorMessage(): string { const form: FormGroup = this.formDir.form; const control = form.get(this.controlPath); if (control && control.touched) { for (let i = 0; i < this.errorTypes.length; ++i) { if (control.hasError(this.errorTypes[i])) { return this._errorMessage(this.errorTypes[i]); } } } return null; } private _errorMessage(code: string): string { const config: {[key: string]: string} = { 'required': 'is required', 'invalidCreditCard': 'is invalid credit card number', }; return config[code]; } } @Component({ selector: 'reactive-forms', viewProviders: [FormBuilder], template: ` <h1>Checkout Form (Reactive)</h1> <form (ngSubmit)="onSubmit()" [formGroup]="form" #f="ngForm"> <p> <label for="firstName">First Name</label> <input type="text" id="firstName" formControlName="firstName" /> <show-error control="firstName" [errors]="['required']"></show-error> </p> <p> <label for="middleName">Middle Name</label> <input type="text" id="middleName" formControlName="middleName" /> </p> <p> <label for="lastName">Last Name</label> <input type="text" id="lastName" formControlName="lastName" /> <show-error control="lastName" [errors]="['required']"></show-error> </p> <p> <label for="country">Country</label> <select id="country" formControlName="country"> <option *ngFor="let c of countries" [value]="c">{{ c }}</option> </select> </p> <p> <label for="creditCard">Credit Card</label> <input type="text" id="creditCard" formControlName="creditCard" /> <show-error control="creditCard" [errors]="['required', 'invalidCreditCard']"></show-error> </p> <p> <label for="amount">Amount</label> <input type="number" id="amount" formControlName="amount" /> <show-error control="amount" [errors]="['required']"></show-error> </p> <p> <label for="email">Email</label> <input type="email" id="email" formControlName="email" /> <show-error control="email" [errors]="['required']"></show-error> </p> <p> <label for="comments">Comments</label> <textarea id="comments" formControlName="comments"> </textarea> </p> <button type="submit" [disabled]="!f.form.valid">Submit</button> </form> `, standalone: false, }) export class ReactiveForms { form: UntypedFormGroup; countries = ['US', 'Canada']; constructor(formBuilder: UntypedFormBuilder) { this.form = formBuilder.group({ 'firstName': ['', Validators.required], 'middleName': [''], 'lastName': ['', Validators.required], 'country': ['Canada', Validators.required], 'creditCard': ['', Validators.compose([Validators.required, creditCardValidator])], 'amount': [0, Validators.required], 'email': ['', Validators.required], 'comments': [''], }); } onSubmit(): void { console.log('Submitting:'); console.log(this.form.value); } } @NgModule({ bootstrap: [ReactiveForms], declarations: [ShowError, ReactiveForms], imports: [BrowserModule, ReactiveFormsModule], }) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 5117, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/model_driven_forms/index.ts" }
angular/modules/playground/src/async/index.html_0_253
<!DOCTYPE html> <html> <head> <title>Async</title> </head> <body> <async-app> Loading... </async-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 253, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/async/index.html" }
angular/modules/playground/src/async/BUILD.bazel_0_653
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "async", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":async"], ) http_server( name = "devserver", srcs = ["index.html"], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 653, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/async/BUILD.bazel" }
angular/modules/playground/src/async/index.ts_0_3104
/** * @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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; @Component({ selector: 'async-app', template: ` <div id="increment"> <span class="val">{{ val1 }}</span> <button class="action" (click)="increment()">Increment</button> </div> <div id="delayedIncrement"> <span class="val">{{ val2 }}</span> <button class="action" (click)="delayedIncrement()">Delayed Increment</button> <button class="cancel" *ngIf="timeoutId != null" (click)="cancelDelayedIncrement()"> Cancel </button> </div> <div id="multiDelayedIncrements"> <span class="val">{{ val3 }}</span> <button class="action" (click)="multiDelayedIncrements(10)">10 Delayed Increments</button> <button class="cancel" *ngIf="multiTimeoutId != null" (click)="cancelMultiDelayedIncrements()" > Cancel </button> </div> <div id="periodicIncrement"> <span class="val">{{ val4 }}</span> <button class="action" (click)="periodicIncrement()">Periodic Increment</button> <button class="cancel" *ngIf="intervalId != null" (click)="cancelPeriodicIncrement()"> Cancel </button> </div> `, standalone: false, }) class AsyncApplication { val1: number = 0; val2: number = 0; val3: number = 0; val4: number = 0; timeoutId: any = null; multiTimeoutId: any = null; intervalId: any = null; increment(): void { this.val1++; } delayedIncrement(): void { this.cancelDelayedIncrement(); this.timeoutId = setTimeout(() => { this.val2++; this.timeoutId = null; }, 2000); } multiDelayedIncrements(i: number): void { this.cancelMultiDelayedIncrements(); const self = this; function helper(_i: number) { if (_i <= 0) { self.multiTimeoutId = null; return; } self.multiTimeoutId = setTimeout(() => { self.val3++; helper(_i - 1); }, 500); } helper(i); } periodicIncrement(): void { this.cancelPeriodicIncrement(); this.intervalId = setInterval(() => this.val4++, 2000); } cancelDelayedIncrement(): void { if (this.timeoutId != null) { clearTimeout(this.timeoutId); this.timeoutId = null; } } cancelMultiDelayedIncrements(): void { if (this.multiTimeoutId != null) { clearTimeout(this.multiTimeoutId); this.multiTimeoutId = null; } } cancelPeriodicIncrement(): void { if (this.intervalId != null) { clearInterval(this.intervalId); this.intervalId = null; } } } @NgModule({ declarations: [AsyncApplication], bootstrap: [AsyncApplication], imports: [BrowserModule], }) class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 3104, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/async/index.ts" }
angular/modules/playground/src/key_events/index.html_0_546
<!DOCTYPE html> <html> <title>Key events</title> <style> .sample-area { text-align: center; margin: 5px; height: 50px; line-height: 50px; border-radius: 5px; border: 1px solid #d0d0d0; } .sample-area:focus { border: 1px solid blue; color: blue; font-weight: bold; } </style> <body> <key-events-app> Loading... </key-events-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 546, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/key_events/index.html" }
angular/modules/playground/src/key_events/BUILD.bazel_0_678
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "key_events", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":key_events"], ) http_server( name = "devserver", srcs = [ "index.html", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 678, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/key_events/BUILD.bazel" }
angular/modules/playground/src/key_events/index.ts_0_2558
/** * @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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; @Component({ selector: 'key-events-app', template: `Click in the following area and press a key to display its name:<br /> <div (keydown)="onKeyDown($event)" class="sample-area" tabindex="0">{{ lastKey }}</div> <br /> Click in the following area and press shift.enter:<br /> <div (keydown.shift.enter)="onShiftEnter($event)" (click)="resetShiftEnter()" class="sample-area" tabindex="0" > {{ shiftEnter ? 'You pressed shift.enter!' : '' }} </div>`, standalone: false, }) export class KeyEventsApp { lastKey: string = '(none)'; shiftEnter: boolean = false; onKeyDown(event: KeyboardEvent): void { this.lastKey = KeyEventsApp._getEventFullKey(event); event.preventDefault(); } onShiftEnter(event: KeyboardEvent): void { this.shiftEnter = true; event.preventDefault(); } resetShiftEnter(): void { this.shiftEnter = false; } /** * Get a more readable version of current pressed keys. * @see KeyEventsPlugin.getEventFullKey */ private static _getEventFullKey(event: KeyboardEvent): string { const modifierKeys = ['alt', 'control', 'meta', 'shift']; const modifierKeyGetters: {[key: string]: (event: KeyboardEvent) => boolean} = { 'alt': (event: KeyboardEvent) => event.altKey, 'control': (event: KeyboardEvent) => event.ctrlKey, 'meta': (event: KeyboardEvent) => event.metaKey, 'shift': (event: KeyboardEvent) => event.shiftKey, }; let fullKey = ''; let key = event.key.toLowerCase(); if (key === ' ') { key = 'space'; // for readability } else if (key === '.') { key = 'dot'; // because '.' is used as a separator in event names } modifierKeys.forEach((modifierName) => { if (modifierName != key) { const modifierGetter = modifierKeyGetters[modifierName]; if (modifierGetter(event)) { fullKey += modifierName + '.'; } } }); return fullKey + key; } } @NgModule({declarations: [KeyEventsApp], bootstrap: [KeyEventsApp], imports: [BrowserModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 2558, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/key_events/index.ts" }
angular/modules/playground/src/person_management/index.html_0_380
<!DOCTYPE html> <html> <head> <title>Person Management</title> <style> .ng-touched.ng-invalid { border-color: red; } </style> </head> <body> <person-management-app> Loading... </person-management-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 380, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/person_management/index.html" }
angular/modules/playground/src/person_management/BUILD.bazel_0_720
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "person_management", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/forms", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":person_management"], ) http_server( name = "devserver", srcs = [ "index.html", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 720, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/person_management/BUILD.bazel" }
angular/modules/playground/src/person_management/index.ts_0_6944
/** * @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, NgModule} from '@angular/core'; import {FormsModule} from '@angular/forms'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; /** * You can find the AngularJS implementation of this example here: * https://github.com/wardbell/ng1DataBinding */ // ---- model let _nextId = 1; class Person { personId: number; mom: Person; dad: Person; friends: Person[]; constructor( public firstName: string, public lastName: string, public yearOfBirth: number, ) { this.personId = _nextId++; this.firstName = firstName; this.lastName = lastName; this.mom = null; this.dad = null; this.friends = []; this.personId = _nextId++; } get age(): number { return 2015 - this.yearOfBirth; } get fullName(): string { return `${this.firstName} ${this.lastName}`; } get friendNames(): string { return this.friends.map((f) => f.fullName).join(', '); } } // ---- services @Injectable() export class DataService { currentPerson: Person; persons: Person[]; constructor() { this.persons = [ new Person('Victor', 'Savkin', 1930), new Person('Igor', 'Minar', 1920), new Person('John', 'Papa', 1910), new Person('Nancy', 'Duarte', 1910), new Person('Jack', 'Papa', 1910), new Person('Jill', 'Papa', 1910), new Person('Ward', 'Bell', 1910), new Person('Robert', 'Bell', 1910), new Person('Tracy', 'Ward', 1910), new Person('Dan', 'Wahlin', 1910), ]; this.persons[0].friends = [0, 1, 2, 6, 9].map((_) => this.persons[_]); this.persons[1].friends = [0, 2, 6, 9].map((_) => this.persons[_]); this.persons[2].friends = [0, 1, 6, 9].map((_) => this.persons[_]); this.persons[6].friends = [0, 1, 2, 9].map((_) => this.persons[_]); this.persons[9].friends = [0, 1, 2, 6].map((_) => this.persons[_]); this.persons[2].mom = this.persons[5]; this.persons[2].dad = this.persons[4]; this.persons[6].mom = this.persons[8]; this.persons[6].dad = this.persons[7]; this.currentPerson = this.persons[0]; } } // ---- components @Component({ selector: 'full-name-cmp', template: ` <h1>Edit Full Name</h1> <div> <form> <div> <label> First: <input [(ngModel)]="person.firstName" type="text" placeholder="First name" name="firstName" /> </label> </div> <div> <label> Last: <input [(ngModel)]="person.lastName" type="text" placeholder="Last name" name="lastName" /> </label> </div> <div> <label>{{ person.fullName }}</label> </div> </form> </div> `, standalone: false, }) export class FullNameComponent { constructor(private _service: DataService) {} get person(): Person { return this._service.currentPerson; } } @Component({ selector: 'person-detail-cmp', template: ` <h2>{{ person.fullName }}</h2> <div> <form> <div> <label >First: <input [(ngModel)]="person.firstName" type="text" placeholder="First name" name="firstName" /></label> </div> <div> <label >Last: <input [(ngModel)]="person.lastName" type="text" placeholder="Last name" name="lastName" /></label> </div> <div> <label >Year of birth: <input [(ngModel)]="person.yearOfBirth" type="number" placeholder="Year of birth" name="yearOfBirth" /></label> Age: {{ person.age }} </div> <div *ngIf="person.mom != null"> <label>Mom:</label> <input [(ngModel)]="person.mom.firstName" type="text" placeholder="Mom's first name" name="momFirstName" /> <input [(ngModel)]="person.mom.lastName" type="text" placeholder="Mom's last name" name="momLastName" /> {{ person.mom.fullName }} </div> <div *ngIf="person.dad != null"> <label>Dad:</label> <input [(ngModel)]="person.dad.firstName" type="text" placeholder="Dad's first name" name="dasFirstName" /> <input [(ngModel)]="person.dad.lastName" type="text" placeholder="Dad's last name" name="dadLastName" /> {{ person.dad.fullName }} </div> <div *ngIf="person.friends.length > 0"> <label>Friends:</label> {{ person.friendNames }} </div> </form> </div> `, standalone: false, }) export class PersonsDetailComponent { constructor(private _service: DataService) {} get person(): Person { return this._service.currentPerson; } } @Component({ selector: 'persons-cmp', template: ` <h1>FullName Demo</h1> <div> <ul> <li *ngFor="let person of persons"> <label (click)="select(person)">{{ person.fullName }}</label> </li> </ul> <person-detail-cmp></person-detail-cmp> </div> `, standalone: false, }) export class PersonsComponent { persons: Person[]; constructor(private _service: DataService) { this.persons = _service.persons; } select(person: Person): void { this._service.currentPerson = person; } } @Component({ selector: 'person-management-app', viewProviders: [DataService], template: ` <button (click)="switchToEditName()">Edit Full Name</button> <button (click)="switchToPersonList()">Person Array</button> <full-name-cmp *ngIf="mode == 'editName'"></full-name-cmp> <persons-cmp *ngIf="mode == 'personList'"></persons-cmp> `, standalone: false, }) export class PersonManagementApplication { mode: string; switchToEditName(): void { this.mode = 'editName'; } switchToPersonList(): void { this.mode = 'personList'; } } @NgModule({ bootstrap: [PersonManagementApplication], declarations: [ PersonManagementApplication, FullNameComponent, PersonsComponent, PersonsDetailComponent, ], imports: [BrowserModule, FormsModule], }) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 6944, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/person_management/index.ts" }
angular/modules/playground/src/todo/index.html_0_345
<!DOCTYPE html> <base> <title>Todo Angular</title> <link rel="stylesheet" href="css/main.css" media="screen" title="no title" charset="utf-8"> <base href="./"> <body> <todo-app> Loading... </todo-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 345, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/index.html" }
angular/modules/playground/src/todo/BUILD.bazel_0_739
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "todo", srcs = glob(["**/*.ts"]), assets = [ "todo.html", "css/base.css", ], tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":todo"], ) http_server( name = "devserver", srcs = ["index.html"] + glob(["**/*.css"]), deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 739, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/BUILD.bazel" }
angular/modules/playground/src/todo/index.ts_0_1953
/** * @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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {Store, Todo, TodoFactory} from './app/TodoStore'; @Component({ selector: 'todo-app', viewProviders: [Store, TodoFactory], templateUrl: 'todo.html', standalone: false, }) export class TodoApp { todoEdit: Todo = null; constructor( public todoStore: Store<Todo>, public factory: TodoFactory, ) {} enterTodo(inputElement: HTMLInputElement): void { this.addTodo(inputElement.value); inputElement.value = ''; } editTodo(todo: Todo): void { this.todoEdit = todo; } doneEditing($event: KeyboardEvent, todo: Todo): void { const which = $event.which; const target = $event.target as HTMLInputElement; if (which === 13) { todo.title = target.value; this.todoEdit = null; } else if (which === 27) { this.todoEdit = null; target.value = todo.title; } } addTodo(newTitle: string): void { this.todoStore.add(this.factory.create(newTitle, false)); } completeMe(todo: Todo): void { todo.completed = !todo.completed; } deleteMe(todo: Todo): void { this.todoStore.remove(todo); } toggleAll($event: MouseEvent): void { const isComplete = ($event.target as HTMLInputElement).checked; this.todoStore.list.forEach((todo: Todo) => { todo.completed = isComplete; }); } clearCompleted(): void { this.todoStore.removeBy((todo: Todo) => todo.completed); } } @NgModule({declarations: [TodoApp], bootstrap: [TodoApp], imports: [BrowserModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 1953, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/index.ts" }
angular/modules/playground/src/todo/todo.html_0_1664
<style>@import "css/base.css";</style> <section id="todoapp"> <header id="header"> <h1>todos</h1> <input id="new-todo" placeholder="What needs to be done?" autofocus #newtodo (keyup.enter)="enterTodo(newtodo)"> </header> <section id="main"> <input id="toggle-all" type="checkbox" (click)="toggleAll($event)"> <label for="toggle-all">Mark all as complete</label> <ul id="todo-list"> <li *ngFor="let todo of todoStore.list"> <div class="view" [class.hidden]="todoEdit == todo"> <input class="toggle" type="checkbox" (click)="completeMe(todo)" [checked]="todo.completed"> <label (dblclick)="editTodo(todo)">{{todo.title}}</label> <button class="destroy" (click)="deleteMe(todo)"></button> </div> <div> <input class="edit" [class.visible]="todoEdit == todo" [value]="todo.title" (keyup)="doneEditing($event, todo)"> </div> </li> </ul> </section> <footer id="footer"> <span id="todo-count"></span> <div [class.hidden]="true"></div> <ul id="filters"> <li> <a href="#/" class="selected">All</a> </li> <li> <a href="#/active">Active</a> </li> <li> <a href="#/completed">Completed</a> </li> </ul> <button id="clear-completed" (click)="clearCompleted()">Clear completed</button> </footer> </section> <footer id="info"> <p>Double-click to edit a todo</p> <p>Created by <a href="https://twitter.com/angular">The Angular Team</a></p> </footer>
{ "end_byte": 1664, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/todo.html" }
angular/modules/playground/src/todo/app/TodoStore.ts_0_1141
/** * @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'; // base model for RecordStore export abstract class KeyModel { constructor(public key: number) {} } export class Todo extends KeyModel { constructor( key: number, public title: string, public completed: boolean, ) { super(key); } } @Injectable() export class TodoFactory { private _uid: number = 0; nextUid(): number { return ++this._uid; } create(title: string, isCompleted: boolean): Todo { return new Todo(this.nextUid(), title, isCompleted); } } // Store manages any generic item that inherits from KeyModel @Injectable() export class Store<T extends KeyModel> { list: T[] = []; add(record: T): void { this.list.push(record); } remove(record: T): void { this.removeBy((item) => item === record); } removeBy(callback: (record: T) => boolean): void { this.list = this.list.filter((record) => !callback(record)); } }
{ "end_byte": 1141, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/app/TodoStore.ts" }
angular/modules/playground/src/todo/css/main.css_0_210
html, body { margin: 0; padding: 0; } body { font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif; line-height: 1.4em; background: #eaeaea; color: #4d4d4d; width: 550px; margin: 0 auto; }
{ "end_byte": 210, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/css/main.css" }
angular/modules/playground/src/todo/css/base.css_0_5454
@charset "utf-8"; button { margin: 0; padding: 0; border: 0; background: none; font-size: 100%; vertical-align: baseline; font-family: inherit; font-weight: inherit; color: inherit; -webkit-appearance: none; -ms-appearance: none; appearance: none; } button, input[type="checkbox"] { outline: none; } .hidden { display: none; } .visible { display: block !important; } #todoapp { background: #fff; margin: 130px 0 40px 0; position: relative; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 25px 50px 0 rgba(0, 0, 0, 0.1); } #todoapp input::-webkit-input-placeholder { font-style: italic; font-weight: 300; color: #e6e6e6; } #todoapp input::-moz-placeholder { font-style: italic; font-weight: 300; color: #e6e6e6; } #todoapp input::input-placeholder { font-style: italic; font-weight: 300; color: #e6e6e6; } #todoapp h1 { position: absolute; top: -155px; width: 100%; font-size: 100px; font-weight: 100; text-align: center; color: rgba(175, 47, 47, 0.15); -webkit-text-rendering: optimizeLegibility; -moz-text-rendering: optimizeLegibility; -ms-text-rendering: optimizeLegibility; text-rendering: optimizeLegibility; } #new-todo, .edit { position: relative; margin: 0; width: 100%; font-size: 24px; font-family: inherit; font-weight: inherit; line-height: 1.4em; border: 0; outline: none; color: inherit; padding: 6px; border: 1px solid #999; box-shadow: inset 0 -1px 5px 0 rgba(0, 0, 0, 0.2); -ms-box-sizing: border-box; box-sizing: border-box; } #new-todo { padding: 16px 16px 16px 60px; border: none; background: rgba(0, 0, 0, 0.003); box-shadow: inset 0 -2px 1px rgba(0,0,0,0.03); } #main { position: relative; z-index: 2; border-top: 1px solid #e6e6e6; } label[for='toggle-all'] { display: none; } #toggle-all { position: absolute; top: -55px; left: -12px; width: 60px; height: 34px; text-align: center; border: none; /* Mobile Safari */ } #toggle-all:before { content: '❯'; font-size: 22px; color: #e6e6e6; padding: 10px 27px 10px 27px; } #toggle-all:checked:before { color: #737373; } #todo-list { margin: 0; padding: 0; list-style: none; } #todo-list li { position: relative; font-size: 24px; border-bottom: 1px solid #ededed; } #todo-list li:last-child { border-bottom: none; } #todo-list li.editing { border-bottom: none; padding: 0; } #todo-list li.editing .edit { display: block; width: 506px; padding: 13px 17px 12px 17px; margin: 0 0 0 43px; } #todo-list li.editing .view { display: none; } #todo-list li .toggle { text-align: center; width: 40px; /* auto, since non-WebKit browsers doesn't support input styling */ height: auto; position: absolute; top: 0; bottom: 0; margin: auto 0; border: none; /* Mobile Safari */ -webkit-appearance: none; -ms-appearance: none; appearance: none; } #todo-list li .toggle:after { content: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#ededed" stroke-width="3"/></svg>'); } #todo-list li .toggle:checked:after { content: url('data:image/svg+xml;charset=utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="-10 -18 100 135"><circle cx="50" cy="50" r="50" fill="none" stroke="#bddad5" stroke-width="3"/><path fill="#5dc2af" d="M72 25L42 71 27 56l-4 4 20 20 34-52z"/></svg>'); } #todo-list li label { white-space: pre; word-break: break-word; padding: 15px 60px 15px 15px; margin-left: 45px; display: block; line-height: 1.2; transition: color 0.4s; } #todo-list li.completed label { color: #d9d9d9; text-decoration: line-through; } #todo-list li .destroy { display: none; position: absolute; top: 0; right: 10px; bottom: 0; width: 40px; height: 40px; margin: auto 0; font-size: 30px; color: #cc9a9a; margin-bottom: 11px; transition: color 0.2s ease-out; } #todo-list li .destroy:hover { color: #af5b5e; } #todo-list li .destroy:after { content: '×'; } #todo-list li:hover .destroy { display: block; } #todo-list li .edit { display: none; } #todo-list li.editing:last-child { margin-bottom: -1px; } #footer { color: #777; padding: 10px 15px; height: 20px; text-align: center; border-top: 1px solid #e6e6e6; } #footer:before { content: ''; position: absolute; right: 0; bottom: 0; left: 0; height: 50px; overflow: hidden; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.2), 0 8px 0 -3px #f6f6f6, 0 9px 1px -3px rgba(0, 0, 0, 0.2), 0 16px 0 -6px #f6f6f6, 0 17px 2px -6px rgba(0, 0, 0, 0.2); } #todo-count { float: left; text-align: left; } #todo-count strong { font-weight: 300; } #filters { margin: 0; padding: 0; list-style: none; position: absolute; right: 0; left: 0; } #filters li { display: inline; } #filters li a { color: inherit; margin: 3px; padding: 3px 7px; text-decoration: none; border: 1px solid transparent; border-radius: 3px; } #filters li a.selected, #filters li a:hover { border-color: rgba(175, 47, 47, 0.1); } #filters li a.selected { border-color: rgba(175, 47, 47, 0.2); } #clear-completed, html #clear-completed:active { float: right; position: relative; line-height: 20px; text-decoration: none; cursor: pointer; visibility: hidden; position: relative; } #
{ "end_byte": 5454, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/css/base.css" }
angular/modules/playground/src/todo/css/base.css_5456_6486
ear-completed::after { visibility: visible; content: 'Clear completed'; position: absolute; right: 0; white-space: nowrap; } #clear-completed:hover::after { text-decoration: underline; } #info { margin: 65px auto 0; color: #bfbfbf; font-size: 10px; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); text-align: center; } #info p { line-height: 1; } #info a { color: inherit; text-decoration: none; font-weight: 400; } #info a:hover { text-decoration: underline; } /* Hack to remove background from Mobile Safari. Can't use it globally since it destroys checkboxes in Firefox */ @media screen and (-webkit-min-device-pixel-ratio:0) { #toggle-all, #todo-list li .toggle { background: none; } #todo-list li .toggle { height: 40px; } #toggle-all { -webkit-transform: rotate(90deg); transform: rotate(90deg); -webkit-appearance: none; appearance: none; } } @media (max-width: 430px) { #footer { height: 50px; } #filters { bottom: 10px; } }
{ "end_byte": 6486, "start_byte": 5456, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/todo/css/base.css" }
angular/modules/playground/src/zippy_component/index.html_0_239
<!DOCTYPE html> <html> <title>Zippy Angular</title> <body> <zippy-app> Loading... </zippy-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 239, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/zippy_component/index.html" }
angular/modules/playground/src/zippy_component/BUILD.bazel_0_706
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "zippy_component", srcs = glob(["**/*.ts"]), assets = ["app/zippy.html"], tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":zippy_component"], ) http_server( name = "devserver", srcs = ["index.html"], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 706, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/zippy_component/BUILD.bazel" }
angular/modules/playground/src/zippy_component/index.ts_0_981
/** * @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 {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {Zippy} from './app/zippy'; @Component({ selector: 'zippy-app', template: ` <zippy (open)="pushLog('open')" (close)="pushLog('close')" title="Details"> This is some content. </zippy> <ul> <li *ngFor="let log of logs">{{ log }}</li> </ul> `, standalone: false, }) export class ZippyApp { logs: string[] = []; pushLog(log: string) { this.logs.push(log); } } @NgModule({declarations: [ZippyApp, Zippy], bootstrap: [ZippyApp], imports: [BrowserModule]}) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 981, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/zippy_component/index.ts" }
angular/modules/playground/src/zippy_component/app/zippy.html_0_228
<div class="zippy"> <div (click)="toggle()" class="zippy__title"> {{ visible ? '&#x25BE;' : '&#x25B8;' }} {{title}} </div> <div [hidden]="!visible" class="zippy__content"> <ng-content></ng-content> </div> </div>
{ "end_byte": 228, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/zippy_component/app/zippy.html" }
angular/modules/playground/src/zippy_component/app/zippy.ts_0_714
/** * @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, EventEmitter, Input, Output} from '@angular/core'; @Component({ selector: 'zippy', templateUrl: './zippy.html', standalone: false, }) export class Zippy { visible: boolean = true; @Input() title: string = ''; @Output() open: EventEmitter<any> = new EventEmitter(); @Output() close: EventEmitter<any> = new EventEmitter(); toggle() { this.visible = !this.visible; if (this.visible) { this.open.emit(null); } else { this.close.emit(null); } } }
{ "end_byte": 714, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/zippy_component/app/zippy.ts" }
angular/modules/playground/src/http/index.html_0_234
<!DOCTYPE html> <html> <title>Hello Http</title> <body> <http-app> Loading... </http-app> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 234, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/http/index.html" }
angular/modules/playground/src/http/BUILD.bazel_0_745
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "http", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/common/http", "//packages/core", "//packages/platform-browser", "//packages/platform-browser-dynamic", "@npm//rxjs", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":http"], ) http_server( name = "devserver", srcs = [ "index.html", "people.json", ], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 745, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/http/BUILD.bazel" }
angular/modules/playground/src/http/index.ts_0_673
/** * @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 {HttpClientModule} from '@angular/common/http'; import {NgModule} from '@angular/core'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; import {HttpCmp} from './app/http_comp'; @NgModule({ declarations: [HttpCmp], bootstrap: [HttpCmp], imports: [BrowserModule, HttpClientModule], }) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 673, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/http/index.ts" }
angular/modules/playground/src/http/app/http_comp.ts_0_677
/** * @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 {HttpClient} from '@angular/common/http'; import {Component} from '@angular/core'; @Component({ selector: 'http-app', template: ` <h1>people</h1> <ul class="people"> <li *ngFor="let person of people">hello, {{ person['name'] }}</li> </ul> `, standalone: false, }) export class HttpCmp { people: Object[]; constructor(http: HttpClient) { http.get('./people.json').subscribe((people: Array<Object>) => (this.people = people)); } }
{ "end_byte": 677, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/http/app/http_comp.ts" }
angular/modules/playground/src/template_driven_forms/index.html_0_384
<!DOCTYPE html> <html> <head> <title>Template Driven Forms</title> <style> .ng-touched.ng-invalid { border-color: red; } </style> </head> <body> <template-driven-forms> Loading... </template-driven-forms> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 384, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/template_driven_forms/index.html" }
angular/modules/playground/src/template_driven_forms/BUILD.bazel_0_713
load("//tools:defaults.bzl", "app_bundle", "http_server", "ng_module") package(default_visibility = ["//modules/playground:__subpackages__"]) ng_module( name = "template_driven_forms", srcs = glob(["**/*.ts"]), tsconfig = "//modules/playground:tsconfig-build.json", deps = [ "//packages/core", "//packages/forms", "//packages/platform-browser", "//packages/platform-browser-dynamic", ], ) app_bundle( name = "app_bundle", entry_point = ":index.ts", deps = [":template_driven_forms"], ) http_server( name = "devserver", srcs = ["index.html"], deps = [ ":app_bundle", "//packages/zone.js/bundles:zone.umd.js", ], )
{ "end_byte": 713, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/template_driven_forms/BUILD.bazel" }
angular/modules/playground/src/template_driven_forms/index.ts_0_5324
/** * @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:no-console */ import {Component, Directive, Host, NgModule} from '@angular/core'; import {FormControl, FormGroup, FormsModule, NG_VALIDATORS, NgForm} from '@angular/forms'; import {BrowserModule} from '@angular/platform-browser'; import {platformBrowserDynamic} from '@angular/platform-browser-dynamic'; /** * A domain model we are binding the form controls to. */ class CheckoutModel { firstName: string; middleName: string; lastName: string; country: string = 'Canada'; creditCard: string; amount: number; email: string; comments: string; } /** * Custom validator. */ export function creditCardValidator(c: FormControl): {[key: string]: boolean} { if (c.value && /^\d{16}$/.test(c.value)) { return null; } else { return {'invalidCreditCard': true}; } } export const creditCardValidatorBinding = { provide: NG_VALIDATORS, useValue: creditCardValidator, multi: true, }; @Directive({ selector: '[credit-card]', providers: [creditCardValidatorBinding], standalone: false, }) export class CreditCardValidator {} /** * This is a component that displays an error message. * * For instance, * * <show-error control="creditCard" [errors]="['required', 'invalidCreditCard']"></show-error> * * Will display the "is required" error if the control is empty, and "invalid credit card" if the * control is not empty * but not valid. * * In a real application, this component would receive a service that would map an error code to an * actual error message. * To make it simple, we are using a simple map here. */ @Component({ selector: 'show-error', inputs: ['controlPath: control', 'errorTypes: errors'], template: ` <span *ngIf="errorMessage !== null">{{ errorMessage }}</span> `, standalone: false, }) export class ShowError { formDir: NgForm; controlPath: string; errorTypes: string[]; constructor(@Host() formDir: NgForm) { this.formDir = formDir; } get errorMessage(): string { const form: FormGroup = this.formDir.form; const control = form.get(this.controlPath); if (control && control.touched) { for (let i = 0; i < this.errorTypes.length; ++i) { if (control.hasError(this.errorTypes[i])) { return this._errorMessage(this.errorTypes[i]); } } } return null; } private _errorMessage(code: string): string { const config: {[key: string]: string} = { 'required': 'is required', 'invalidCreditCard': 'is invalid credit card number', }; return config[code]; } } @Component({ selector: 'template-driven-forms', template: ` <h1>Checkout Form</h1> <form (ngSubmit)="onSubmit()" #f="ngForm"> <p> <label for="firstName">First Name</label> <input type="text" id="firstName" name="firstName" [(ngModel)]="model.firstName" required /> <show-error control="firstName" [errors]="['required']"></show-error> </p> <p> <label for="middleName">Middle Name</label> <input type="text" id="middleName" name="middleName" [(ngModel)]="model.middleName" /> </p> <p> <label for="lastName">Last Name</label> <input type="text" id="lastName" name="lastName" [(ngModel)]="model.lastName" required /> <show-error control="lastName" [errors]="['required']"></show-error> </p> <p> <label for="country">Country</label> <select id="country" name="country" [(ngModel)]="model.country"> <option *ngFor="let c of countries" [value]="c">{{ c }}</option> </select> </p> <p> <label for="creditCard">Credit Card</label> <input type="text" id="creditCard" name="creditCard" [(ngModel)]="model.creditCard" required credit-card /> <show-error control="creditCard" [errors]="['required', 'invalidCreditCard']"></show-error> </p> <p> <label for="amount">Amount</label> <input type="number" id="amount" name="amount" [(ngModel)]="model.amount" required /> <show-error control="amount" [errors]="['required']"></show-error> </p> <p> <label for="email">Email</label> <input type="email" id="email" name="email" [(ngModel)]="model.email" required /> <show-error control="email" [errors]="['required']"></show-error> </p> <p> <label for="comments">Comments</label> <textarea id="comments" name="comments" [(ngModel)]="model.comments"> </textarea> </p> <button type="submit" [disabled]="!f.form.valid">Submit</button> </form> `, standalone: false, }) export class TemplateDrivenForms { model = new CheckoutModel(); countries = ['US', 'Canada']; onSubmit(): void { console.log('Submitting:'); console.log(this.model); } } @NgModule({ declarations: [TemplateDrivenForms, CreditCardValidator, ShowError], bootstrap: [TemplateDrivenForms], imports: [BrowserModule, FormsModule], }) export class ExampleModule {} platformBrowserDynamic().bootstrapModule(ExampleModule);
{ "end_byte": 5324, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/template_driven_forms/index.ts" }
angular/modules/playground/src/gestures/index.html_0_605
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Hammer.JS</title> <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1" /> <style type="text/css"> html, body { height: 100%; margin: 0; padding: 0; } </style> </head> <body> <gestures-app></gestures-app> <script src="/npm/node_modules/hammerjs/hammer.js"></script> <script src="/angular/packages/zone.js/bundles/zone.umd.js"></script> <script src="/app_bundle.js"></script> </body> </html>
{ "end_byte": 605, "start_byte": 0, "url": "https://github.com/angular/angular/blob/main/modules/playground/src/gestures/index.html" }