Stack Exchange
How to know whether it is Control or ControlGroup in Angular 2?
let aa = this._formBuilder.control("");
let bb = this._formBuilder.group({
    aa: aa
};

I want to do something like this:
if (typeof(aa) == "Control") {
    // do something
} else if (typeof(aa) == "ControlGroup") {
    // do something
}

But right now both typeof(aa) and typeof(bb) returns object.
console.log(typeof(aa));  // object
console.log(typeof(bb));  // object

How to know whether it is Control or ControlGroup? Thanks

You could use the instanceof operator:
if (aa instanceof Control) {
  // do something
} else if (aa instanceof ControlGroup) {
  // do something
}

