Skip to content

Commit

Permalink
chore: migrate to standalone components API
Browse files Browse the repository at this point in the history
  • Loading branch information
mpalourdio committed Sep 11, 2024
1 parent f67b023 commit cf694c6
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 67 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## v0.13.0
- Embrace standalone components and get rig of `NgModule`.

## v0.12.0

- `angular 18` migration.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Use the fork, Luke. PR without tests will likely not be merged.

## What is it ?

It's an angular component to easily integrate [intl-tel-input](https://github.com/jackocnr/intl-tel-input).
It's an angular standalone component to easily integrate [intl-tel-input](https://github.com/jackocnr/intl-tel-input).

## Installation

Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/intl-tel-input.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<label [attr.for]="name" [ngClass]="labelCssClass" *ngIf="label && name" >{{label}}</label>
@if (label && name) {
<label [attr.for]="name" [ngClass]="labelCssClass" >{{ label }}</label>
}
<input
type="text"
[ngClass]="cssClass"
Expand Down
4 changes: 1 addition & 3 deletions src/lib/components/intl-tel-input.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ describe('IntlTelInputComponent', () => {

beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [
IntlTelInputComponent,
],
imports: [
IntlTelInputComponent,
FormsModule,
],
providers: [
Expand Down
5 changes: 4 additions & 1 deletion src/lib/components/intl-tel-input.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,18 @@
*/

import { AfterViewInit, Component, ElementRef, EventEmitter, Input, Output, ViewChild } from '@angular/core';
import { ControlContainer, NgForm } from '@angular/forms';
import { ControlContainer, FormsModule, NgForm } from '@angular/forms';
import intlTelInput from 'intl-tel-input';
import { IntlTelInputOptions } from '../model/intl-tel-input-options';
import { IntlTelInput } from "../model/intl-tel-input";
import { NgClass } from "@angular/common";

@Component({
selector: 'intl-tel-input',
standalone: true,
templateUrl: './intl-tel-input.component.html',
styleUrls: ['./intl-tel-input.component.scss'],
imports: [NgClass, FormsModule],
viewProviders: [{ provide: ControlContainer, useExisting: NgForm }]
})
export class IntlTelInputComponent implements AfterViewInit {
Expand Down
27 changes: 0 additions & 27 deletions src/lib/intl-tel-input-ng.module.spec.ts

This file was deleted.

34 changes: 0 additions & 34 deletions src/lib/intl-tel-input-ng.module.ts

This file was deleted.

0 comments on commit cf694c6

Please sign in to comment.