I am trying to use enum in angularjs 2 templates. Below is my code
@Component({
selector: \'test\',
template: `
&
SectionType can't be used directly within the template. Either you set it to a property of your component, either you add specify methods to check:
@Component({
selector: 'test',
template: `
`
})
export class TestComponent{
activeSection: SectionType = SectionType.Primary;
setActiveSection(section: SectionType) {
this.activeSection = section;
}
isPrimarySection(activeSection) {
return activeSection == SectionType.Primary
}
}
or
@Component({
selector: 'test',
template: `
`
})
export class TestComponent{
activeSection: SectionType = SectionType.Primary;
setActiveSection(section: SectionType) {
this.activeSection = section;
}
SectionType:SectionType = SectionType;
}