UNPKG

ngx-daum-postcode

Version:

카카오에서 제공하는 [우편번호 서비스](https://postcode.map.daum.net/guide)를 Angular 환경에서 편하게 사용하기 위해 감싼 WrapperComponent를 제공하는 비공식 라이브러리입니다.

60 lines (55 loc) 2.63 kB
import { DOCUMENT } from '@angular/common'; import * as i0 from '@angular/core'; import { output, Component, Inject } from '@angular/core'; class NgxDaumPostcodeComponent { constructor(document, renderer, hostElement) { this.document = document; this.renderer = renderer; this.hostElement = hostElement; this.onComplete = output(); this.onResize = output(); this.onSearch = output(); } ngOnInit() { const src = "//t1.daumcdn.net/mapjsapi/bundle/postcode/prod/postcode.v2.js"; const scriptElement = this.renderer.createElement("script"); scriptElement.type = "text/javascript"; scriptElement.src = src; scriptElement.onload = () => { this.initDaumPostcode(); }; this.renderer.appendChild(this.document.body, scriptElement); } initDaumPostcode() { new daum.Postcode({ width: "100%", height: "100%", oncomplete: (data) => { this.onComplete.emit(data); }, onresize: (data) => { this.onResize.emit(data); }, onsearch: (data) => { this.onSearch.emit(data); }, }).embed(this.hostElement.nativeElement); } static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: NgxDaumPostcodeComponent, deps: [{ token: DOCUMENT }, { token: i0.Renderer2 }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Component }); } static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.1.6", type: NgxDaumPostcodeComponent, isStandalone: true, selector: "ngx-daum-postcode", outputs: { onComplete: "onComplete", onResize: "onResize", onSearch: "onSearch" }, ngImport: i0, template: "", styles: [":host{display:block;width:100%;height:500px}\n"] }); } } i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.1.6", ngImport: i0, type: NgxDaumPostcodeComponent, decorators: [{ type: Component, args: [{ selector: "ngx-daum-postcode", standalone: true, template: "", styles: [":host{display:block;width:100%;height:500px}\n"] }] }], ctorParameters: () => [{ type: Document, decorators: [{ type: Inject, args: [DOCUMENT] }] }, { type: i0.Renderer2 }, { type: i0.ElementRef }] }); /* * Public API Surface of ngx-daum-postcode */ /** * Generated bundle index. Do not edit. */ export { NgxDaumPostcodeComponent }; //# sourceMappingURL=ngx-daum-postcode.mjs.map