I've hit a roadblock with this problem and after spending quite a few hours on it, I need one of you to point out where I'm going wrong :)
The issue I'm facing is that the component below is throwing an error saying 'No provider for TemplateRef!'. You can check out the Plunker example here. The ngSwitch syntax that I used is from here.
import {Component} from '@angular/core'
//I thought importing CORE_DIRECTIVES would make the NgSwitch family available, but no luck.
import {CORE_DIRECTIVES} from '@angular/common'
//I also tried explicitly importing NgSwitch and NgSwitchWhen separately
@Component({
selector: 'my-app',
providers: [],
template: `
<div>
<h2>Hello {{name}}</h2>
<div [ngSwitch]="switchValue">
<div ngSwitchWhen="42">It's 42!</div>
<div ngSwitchWhen="21">It's 21!</div>
</div>
</div>
`,
directives: [CORE_DIRECTIVES]
//I also tried using directives: [NgSwitch,NgSwitchWhen] instead
})
export class App {
switchValue = 42;
constructor() {
this.name = 'Angular2 (Release Candidate!)'
}
}