Build native apps for iOS and Android
[The perfect use case for ng2 custom rendering]
Presented by
Avi Haiat - thaiat@yoobic.com
“The demoscene is an international computer art subculture that specializes in producing demos. The main goal of a demo is to show off programming, artistic, and musical skills.”
<Button Text="{buttonText}" Clicked="{onClick}"/>
var Observable = require('FuseJS/Observable');
var buttonText = Observable('Button');
var clickCount = 0;
function onClick() {
clickCount += 1;
buttonText.value = 'Clicks: ' + clickCount;
}
module.exports = {
buttonText: buttonText,
onClick: onClick
}
import { Component, Input } from '@angular/core';
@Component({
selector: 'my-button',
template: require('./my-button.component.ngux')
})
export class MyButtonComponent {
@Input() text: String;
clickCount: Number = 0;
constructor() {
this.text = 'Click me';
}
onClicked() {
this.clickCount += 1;
this.text = 'Clicks' + clickCount;
}
}
<Panel ng:Selector="my-button">
<Button
Text="{{text}}"
(Clicked)="onClicked()" />
</Panel>
class Renderer {
selectRootElement(...) : any
createElement(...) : any
createViewRoot(...) : any
createTemplateAnchor(...) : any
createText(...) : any
projectNodes(...) : void
attachViewAfter(...) : void
detachView(...) : void
destroyView(...) : void
listen(...) : Function
listenGlobal(...) : Function
setElementProperty(...) : void
setElementAttribute(...) : void
setBindingDebugInfo(...) : void
setElementClass(...) : void
setElementStyle(...) : void
invokeElementMethod(...) : void
setText(...) : void
animate(...) : AnimationPlayer
}
@Injectable()
export class FuseRenderer implements Renderer {
...
}
@NgModule
providers: [
FuseRenderer,
{ provide: Renderer, useClass: FuseRenderer },
]
// bootstrap
let _platformFuseDynamic = createPlatformFactory(
platformCoreDynamic,
'FuseDynamic',
FUSE_COMPILER_PROVIDERS);
export function platformFuseDynamic(extraProviders?: any[]): PlatformRef {
return new FusePlatformRef(_platformFuseDynamic(extraProviders));
}
platformFuseDynamic().bootstrapModule(MyAppModule);
This is boooring... Show me the code
Let's play with the baby and see how easy it is to build a mobile app
and one more thing...