So with the idea that angular2 will support multiple rendering engines (HTML, native via NativeScript & React Native) what does that development story look like?
Is there dynamic template switching? Or should this be handled via sub-classing?
// TypeScript ahead
// Base component implementation
class FooComponent {
public name: string = 'my name';
public makeFormal () {
this.name = this.name.toUpperCase();
}
}
// HTML Component
@Component({
selector: '<foo></foo>'
template: `
<div>{{name}}</div>
<button (click)="makeFormal()">Make Formal</button>
`
})
class FooHtmlComponent extends FooComponent {
constructor(){
super();
}
}
// Native Component
@Component({
selector: '<foo></foo>'
template: '... [native stuffs here] ...'
})
class FooHtmlComponent extends FooComponent {
constructor(){
super();
}
}