File

universal/src/directives/non-browser-only.directive.ts

Description

Renders the marked element only on non-browser platforms.

Extends

PlatformDirective

Metadata

Index

Methods

Methods

Protected shouldRender
shouldRender()
Inherited from PlatformDirective

Checks whether the element should be rendered on the current platform.

Returns: boolean
ngOnInit
ngOnInit()
Inherited from PlatformDirective

Checks whether the element should be rendered on the current platform and renders it.

Returns: void
import { Directive } from '@angular/core';

import { PlatformDirective } from './platform.directive';

/**
 * Renders the marked element only on non-browser platforms.
 *
 * @export
 * @class NonBrowserOnlyDirective
 * @extends {PlatformDirective}
 */
@Directive({
    selector: '[nonBrowserOnly]'
})
export class NonBrowserOnlyDirective extends PlatformDirective
{
    /**
     * Checks whether the element should be rendered on the current platform.
     *
     * @protected
     * @returns {boolean}
     */
    protected shouldRender(): boolean
    {
        return !this.universal.isPlatformBrowser;
    }
}

results matching ""

    No results matching ""