[@rxap/directives](../wiki/globals) / IfTruthyDirective

# Class: IfTruthyDirective\<Data, Parameters\>

Defined in: [if-truthy.directive.ts:22](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L22)

## Type Parameters

• **Data**

• **Parameters** = `any`

## Implements

- `OnChanges`

## Constructors

### new IfTruthyDirective()

> **new IfTruthyDirective**\<`Data`, `Parameters`\>(`templateRef`, `viewContainerRef`, `cdr`): [`IfTruthyDirective`](../wiki/Class.IfTruthyDirective)\<`Data`, `Parameters`\>

Defined in: [if-truthy.directive.ts:32](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L32)

#### Parameters

##### templateRef

`TemplateRef`\<[`IfTruthyDirectiveTemplateContext`](../wiki/Interface.IfTruthyDirectiveTemplateContext)\<`Data`\>\>

##### viewContainerRef

`ViewContainerRef`

##### cdr

`ChangeDetectorRef`

#### Returns

[`IfTruthyDirective`](../wiki/Class.IfTruthyDirective)\<`Data`, `Parameters`\>

## Properties

### method

> **method**: `Method`\<`Data`, `Parameters`\>

Defined in: [if-truthy.directive.ts:25](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L25)

***

### parameters

> **parameters**: `Parameters`

Defined in: [if-truthy.directive.ts:27](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L27)

***

### trackBy()

> **trackBy**: (`data`) => `any`

Defined in: [if-truthy.directive.ts:29](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L29)

#### Parameters

##### data

`Data`

#### Returns

`any`

## Methods

### execute()

> `protected` **execute**(): `Promise`\<`void`\>

Defined in: [if-truthy.directive.ts:60](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L60)

#### Returns

`Promise`\<`void`\>

***

### hasChanged()

> `protected` **hasChanged**(`current`): `boolean`

Defined in: [if-truthy.directive.ts:78](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L78)

#### Parameters

##### current

`Data`

#### Returns

`boolean`

***

### ngOnChanges()

> **ngOnChanges**(`changes`): `void`

Defined in: [if-truthy.directive.ts:52](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L52)

A callback method that is invoked immediately after the
default change detector has checked data-bound properties
if at least one has changed, and before the view and content
children are checked.

#### Parameters

##### changes

`SimpleChanges`

The changed properties.

#### Returns

`void`

#### Implementation of

`OnChanges.ngOnChanges`

***

### ngTemplateContextGuard()

> `static` **ngTemplateContextGuard**\<`T`\>(`dir`, `ctx`): `ctx is IfTruthyDirectiveTemplateContext<T>`

Defined in: [if-truthy.directive.ts:45](https://gitlab.com/rxap/packages/-/blob/36b0e9732b24717840935712e316593ff6aba795/packages/angular/directives/src/lib/if-truthy.directive.ts#L45)

Asserts the correct type of the context for the template that `NgForOf` will render.

The presence of this method is a signal to the Ivy template type-check compiler that the
`NgForOf` structural directive renders its template with a specific context type.

#### Type Parameters

• **T**

#### Parameters

##### dir

[`IfTruthyDirective`](../wiki/Class.IfTruthyDirective)\<`T`\>

##### ctx

`any`

#### Returns

`ctx is IfTruthyDirectiveTemplateContext<T>`
