Ionic ngClass not working (fixed)

I am fairly new to ionic so excuse my newbie question. I searched all over for a solution and tried different things none with success and I can’t figure what I am missing.

I have a button which calls a function on click which toggles a boolean variable true/false

<button class="button" (click)="activate();"><i class="icon-font-size"></i></button>

I than added ngClass on a div that will add or remove class basest on the boolean var value

<div class="text-settings" [ngClass]="{'open': active === true}">

In the TS file of the page I have

import { Component } from '@angular/core';
import { NavController, NavParams } from 'ionic-angular';

  Generated class for the SinglePost page.

  See for more info on
  Ionic pages and navigation.

  selector: 'page-single-post',
  templateUrl: 'single-post.html',

export class SinglePostPage {

  selectedItem: any;
  active : boolean = false;

  constructor(public navController: NavController, public navParams2: NavParams) {
    this.selectedItem = navParams2.get('item');

  activate() { = !;


What you posted here works, so if you are having a problem with it, the problem lies elsewhere. That being said, it could be simplified to:

<div []="active">

Thanks for you quick response. The problem must be elsewhere than I’ll keep digging. I recently updated Ionic’s version to the latest maybe I missed something in the setup.

This what I get from ionic info in case you spot anything, I’ll keep searching tho. Thanks again!

cli packages: (node_modules)

    @ionic/cli-plugin-cordova       : 1.6.2
    @ionic/cli-plugin-ionic-angular : 1.4.1
    @ionic/cli-utils                : 1.7.0
    ionic (Ionic CLI)               : 3.7.0

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.3
    Cordova Platforms  : ios 4.4.0
    Ionic Framework    : ionic-angular 3.6.0


    Node       : v6.5.0
    OS         : macOS Sierra
    Xcode      : Xcode 8.3.3 Build version 8E3004b
    ios-deploy : 1.9.1
    ios-sim    : 5.0.13
    npm        : 3.10.3

I think I found the problem because I upgraded form ionic 2 to 3 I was missing the IonicPage import on this line import { NavController, NavParams } from 'ionic-angular'; added that and it started working. Thanks @rapropos for your input.

so that second line in the TS file should have been

import { IonicPage, NavController, NavParams } from 'ionic-angular';