@Component({selector:'foo', template: `some nativescript template`}) class Foo {}
matches with:
@Component({selector:'foo'`}) @View({ template: `some nativescript template` }) class Foo {}
You can then provide several views for the same component.
@Component({selector:'foo'}) @View({ template: `some nativescript template`, platform: 'nativescript' }) @View({ template: `some dom stuff`, platform: 'dom' }) class Foo { }
Finally, the build step will create a package for each platform, with all the code designed to remove other platforms. The same method can be used to provide language patterns for components.
- Angular 2 allows you to write a component with one view, which can work on all dom platforms (browser, node, web worker).
So you can just do the following:
@Component({selector:'foo', template: `some dom template`}) class Foo {}
Victor savkin
source share