
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
angular-comparison
Advanced tools
A collection of comparison directives for Angular
Add the package to your application.
npm install --save angular-comparison
Import the comparison module to your angular module.
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';
import { ComparisonModule } from 'angular-comparison';
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
ComparisonModule
],
declarations: [AppComponent],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule {
}
Add the equal to directive to an input element and specify the value to compare.
<input type="number" name="first" [(ngModel)]="values.first">
<input type="number" #second="ngModel" name="second" [(ngModel)]="values.second" [ngEqualTo]="values.first">
Then, you can add a specific error message if the input value is not equal to the specified one.
<div *ngIf="second.errors && (second.dirty || second.touched)">
<div [hidden]="!second.errors.ngEqualTo">Second value must be equal to {{values.first}}.</div>
</div>
Add the greater than directive to an input element and specify the value to compare.
<input type="number" name="first" [(ngModel)]="values.first">
<input type="number" #second="ngModel" name="second" [(ngModel)]="values.second" [ngGreaterThan]="values.first">
Then, you can add a specific error message if the input value is not greater than the specified one.
<div *ngIf="second.errors && (second.dirty || second.touched)">
<div [hidden]="!second.errors.ngGreaterThan">Second value must be greater than {{values.first}}.</div>
</div>
Add the greater than or equal directive to an input element and specify the value to compare.
<input type="number" name="first" [(ngModel)]="values.first">
<input type="number" #second="ngModel" name="second" [(ngModel)]="values.second" [ngGreaterThanOrEqual]="values.first">
Then, you can add a specific error message if the input value is not greater than or equal to the specified one.
<div *ngIf="second.errors && (second.dirty || second.touched)">
<div [hidden]="!second.errors.ngGreaterThanOrEqual">Second value must be greater than or equal to {{values.first}}.</div>
</div>
Add the lower than directive to an input element and specify the value to compare.
<input type="number" name="first" [(ngModel)]="values.first">
<input type="number" #second="ngModel" name="second" [(ngModel)]="values.second" [ngLowerThan]="values.first">
Then, you can add a specific error message if the input value is not lower than the specified one.
<div *ngIf="second.errors && (second.dirty || second.touched)">
<div [hidden]="!second.errors.ngLowerThan">Second value must be lower than {{values.first}}.</div>
</div>
Add the lower than or equal directive to an input element and specify the value to compare.
<input type="number" name="first" [(ngModel)]="values.first">
<input type="number" #second="ngModel" name="second" [(ngModel)]="values.second" [ngLowerThanOrEqual]="values.first">
Then, you can add a specific error message if the input value is not lower than or equal to the specified one.
<div *ngIf="second.errors && (second.dirty || second.touched)">
<div [hidden]="!second.errors.ngLowerThanOrEqual">Second value must be lower than or equal to {{values.first}}.</div>
</div>
Add the not equal to directive to an input element and specify the value to compare.
<input type="number" name="first" [(ngModel)]="values.first">
<input type="number" #second="ngModel" name="second" [(ngModel)]="values.second" [ngNotEqualTo]="values.first">
Then, you can add a specific error message if the input value is equal to the specified one.
<div *ngIf="second.errors && (second.dirty || second.touched)">
<div [hidden]="!second.errors.ngNotEqualTo">Second value must be different from {{values.first}}.</div>
</div>
FAQs
A collection of comparison directives for Angular
The npm package angular-comparison receives a total of 6 weekly downloads. As such, angular-comparison popularity was classified as not popular.
We found that angular-comparison demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.