Simple observable example

plugins

#1

Hello !

Trying observable in Type script.

login.xml:

<Page loaded="loaded">
    <ActionBar title="{{ title }}" class="action-bar"></ActionBar>
    <StackLayout orientation="vertical">
        <Image src="res://icon" stretch="none" horizontalAlignment="center" ></Image>

        <TextField id="email" text="{{ email }}" hint="Email Address" keyboardType="email" autocorrect="false" autocapitalizationType="none" />
        <TextField secure="true" text="{{ password }}" hint="Password" />

        <Button text="Sign in" tap="signIn" />
        <Button text="Sign up" class="link" isEnabled = "false" />
    </StackLayout>
</Page>

login.ts:

import { fromObject } from "data/observable";

const source = fromObject({
    email: "Text set via twoWay binding"
});

export function onLoaded(args): void {
    let drawerComponent = args.object;   
    drawerComponent.bindingContext = source;
}

No effect.


#2

login.ts:

import { fromObject } from "data/observable";

const source = fromObject({
    email: "Text set via twoWay binding"
});

export function loaded(args) {
    let drawerComponent = args.object;   
    drawerComponent.bindingContext = source;
}