angular-decorators icon indicating copy to clipboard operation
angular-decorators copied to clipboard

properties on component not accessible inside component

Open vanhumbeecka opened this issue 8 years ago • 1 comments

Suppose

@Component({
    selector: 'time-table',
    controllerAs: 'TimeTableCtrl',
    properties: [
        '@minHour',
        '@maxHour',
        '=myEvents'
    ]
})
@View({template: require('./timetable.html')})
@Inject('$log')
export class TimeTableComponent {

How can I access the myEvents in the TimeTableComponent? I cannot seem to reference them inside the component itself. Using '{{TimeTableCtrl.myEvents}}' in HTML works!

vanhumbeecka avatar Dec 26 '16 10:12 vanhumbeecka

Ok, I solved it myself. Needed to add a @Require tag, like so

@Component({
    selector: 'time-table',
    properties: [
        '@minHour',
        '@maxHour',
        '=myEvents'
    ]
})
@View({template: require('./timetable.html')})
@Inject('$log')
@Require('^parent')
export class TimeTableComponent {

vanhumbeecka avatar Dec 26 '16 10:12 vanhumbeecka