Easy data binding questions

I’m trying to display a bunch of information stored in an array which is posted to the view.

This code sends the data object variable to the view when the user has clicked a button.

this.zone.run(() => {
            this.place = place;
        });

I have tried to bind {{ place.user_id }} but it returns:

EXCEPTION: Error in ./HomePage class HomePage - inline template:8:35 caused by: undefined is not an object (evaluating 'self.context.place.user_id')

Here’s what the object looks like:

image

Place is only instantiated after the user clicks a button on the home page

That’s the problem. You can either modify the template to be able to deal with place being empty or initialize place to something in the constructor.

Thanks. All sorted. Initialised a blank ‘place’ object in the constructor.