Eliya Cohen Eliya Cohen - 1 year ago 63
AngularJS Question

Angular 2 export property which is string or null

Let's say I have a property that can be a String or NULL. So I thought about doing this in Angular 2:

export class Slide {
link: string|null;

and then I get an error which says

Type expected.

So, how can I tell Angular that my
property can be either String or NULL?


link: string; is sufficient.

You can always store null in a property, whatever its type is.