Angular 2 Component @Input not working

I am stuck on trying to pass a property value into my component. From what I've read everything looks correct. But it is still not working. My test value gets output to the screen and the console as null. :(

This is my test component:

import {Component, Input} from 'angular2/angular2';

    selector: 'TestCmp',
    template: `Test Value : {{test}}`

export class TestCmp {

    @Input() test: string;

        console.log('This if the value for user-id: ' + this.test);

This is how I am calling the component from the parent page.

<TestCmp [test]='Blue32'></TestCmp>

When the page render's the test value is empty. I only see 'Test Value :'.

Instead of 'Test Value : Blue32'.



Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.