isHttps

The isHttps pipe is an Angular pipe that checks if a URL string uses the HTTPS protocol. It's useful for conditional rendering, validation, or security checks in templates. A corresponding isHttps utility function is also available for use in TypeScript.

Examples

Example 1: Basic Usage

Check if a URL uses HTTPS protocol:

import {IsHttpsPipe} from 'ngx-lift';

@Component({
  imports: [IsHttpsPipe],
  template: `
    <p>{{ 'https://www.example.com' | isHttps }}</p>
    <!-- Output: true -->

    <p>{{ 'http://www.example.com' | isHttps }}</p>
    <!-- Output: false -->
  `
})
export class IsHttpsExampleComponent {}

Example 2: Conditional Rendering

Conditionally render components based on HTTPS status:

import {IsHttpsPipe} from 'ngx-lift';

@Component({
  imports: [IsHttpsPipe],
  template: `
    @if(url | isHttps) {
      <secure-component [url]="url" />
    } @else {
      <p>Please use HTTPS</p>
    }
  `
})

Example 3: Security Validation

Display security indicators based on protocol:

import {IsHttpsPipe} from 'ngx-lift';

@Component({
  imports: [IsHttpsPipe],
  template: `
    <div>
      <span>{{ url }}</span>
      @if(url | isHttps) {
        <clr-icon shape="shield" status="success" />
      }
    </div>
  `
})

API Reference

isHttps

Angular pipe that checks if a URL string uses the HTTPS protocol.

Signature

transform(value: string): boolean

Parameters

  • value: string

    The URL string to check.

Returns

true if the URL uses HTTPS protocol, false otherwise.