0

I want to pass a object containing multiple string values to another component using angularjs bindings.

const personName = {
    firstName: this.conversation.customer.firstName,
    lastName: this.conversation.customer.lastName
};

const template = `
    <register-task-popup
        chat-contact-info='${personName}'
    ></register-task-popup>`;

this.$mdDialog.show({
    template,
    targetEvent: null,
    clickOutsideToClose: false
});

In my registerTaskPopUpComponent I have:

selector: 'register-task-popup',
bindings: {
    chatContactInfo: '<'
}

private chatContactInfo: any;

public async $onInit() {
    console.log(this.chatContactInfo);
}

When I run the code the console only logs:

angular.js:15567 Error: [$parse:ueoe] Unexpected end of expression: [object

I'm not sure what's causing the error.

1

1 Answer 1

1

Use:

const personName = {
    firstName: this.conversation.customer.firstName,
    lastName: this.conversation.customer.lastName
};

const template = `
    <register-task-popup
        chat-contact-info='${JSON.stringify(personName)}'
    ></register-task-popup>`;

this.$mdDialog.show({
    template,
    targetEvent: null,

Because [object object] does not parse well.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.