Angular
Это содержимое пока не доступно на вашем языке.
Wink components are themselves Angular Elements — they integrate naturally in Angular applications. The only setup required is telling Angular’s compiler to allow unknown element names.
Install
Section titled “Install”npm install @wink/elementsBootstrap — load CDN once
Section titled “Bootstrap — load CDN once”Call load() before bootstrapApplication (or inside APP_INITIALIZER):
import { bootstrapApplication } from '@angular/platform-browser';import { AppComponent } from './app/app.component';import { load } from '@wink/elements';
load({ clientId: import.meta.env['NG_APP_WINK_CLIENT_ID'] });
bootstrapApplication(AppComponent).catch(console.error);Allow custom element names
Section titled “Allow custom element names”Add CUSTOM_ELEMENTS_SCHEMA to every standalone component (or module) that renders <wink-*> tags:
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
@Component({ selector: 'app-hotels', standalone: true, schemas: [CUSTOM_ELEMENTS_SCHEMA], template: ` <wink-content-loader layout="HOTEL" [id]="layoutId" /> <wink-lookup /> `,})export class HotelsComponent { layoutId = 'YOUR_LAYOUT_ID';}Binding attributes
Section titled “Binding attributes”Angular’s template syntax works directly with custom element string attributes:
<!-- Static --><wink-content-loader layout="HOTEL" id="abc123" />
<!-- Dynamic binding --><wink-content-loader [attr.layout]="layout" [attr.id]="layoutId" />Use [attr.name] binding when the value is dynamic — Angular’s regular [property] binding targets DOM properties, not HTML attributes, which custom elements rely on.
Environment variables
Section titled “Environment variables”For @angular/cli 16+ projects, use environment.ts or the NG_APP_* prefix with @ngx-env/builder:
export const environment = { winkClientId: 'YOUR_CLIENT_ID',};import { environment } from './environments/environment';load({ clientId: environment.winkClientId });TypeScript types
Section titled “TypeScript types”The @wink/elements package exports typed interfaces for all component attributes:
import type { WinkContentLoaderAttributes, WinkLayout } from '@wink/elements';
const attrs: WinkContentLoaderAttributes = { layout: 'HOTEL' as WinkLayout, id: 'abc123',};