Skip to content

Latest commit

 

History

History
31 lines (30 loc) · 767 Bytes

README.md

File metadata and controls

31 lines (30 loc) · 767 Bytes

TypeScript-Knockoutjs

Example:

module app {
    export module models {
        export class contact {
            Id: number = 0;
            Name = ko.observable('');
            SurName = ko.observable('');
            FullName;
            constructor () {
                this.FullName = ko.computed(function () {
                    return this.Name() + " " + this.SurName();
                }, this);
            }
        }
    }
    export module viewModels{
        export class contacts {
            items= ko.observableArray([]);
            addContact(){
                this.items.push(new app.models.contact);
            };
        }
    }
}
var viewModel = new app.viewModels.contacts;
ko.applyBindings(viewModel);