本文整理汇总了TypeScript中knockout.applyBindings函数的典型用法代码示例。如果您正苦于以下问题:TypeScript applyBindings函数的具体用法?TypeScript applyBindings怎么用?TypeScript applyBindings使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了applyBindings函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: UIBinding
UIBinding(model: any) {
this.bookingLeftViewModel.bbModel = model;
this.bookingLeftViewModel.model = kb.viewModel(model);
ko.cleanNode($(this.bookingLeftView.el)[0]);
ko.applyBindings(this.bookingLeftViewModel, this.bookingLeftView.el);
}
示例2: constructor
}
class People{
firstName: string;
lastName: string
constructor(first: string, last: string){
this.firstName = first;
this.lastName = last;
}
}
class Product{
name: string
userRate: KnockoutObservable<string>
constructor(name:string){
this.name = name;
this.userRate=ko.observable("");
}
}
var vm = new ViewModel();
ko.applyBindings(vm);
vm.detail("<em>For further details, view the report <a href='report.html'>here</a>.</em>");
//vm.add()
ko.components.register("like-or-dislike", {require: 'components/component-like-widget'});
示例3:
import * as reactDOM from "react-dom";
import {SomeComponentList, TestComponentFullSample} from "./ReactComponents/ComponentA";
console.log("I am working");
ko.components.register("ko-component", {
viewModel: KoComponent,
template: KoComponent.template
});
ko.components.register("ko-list", {
viewModel: KoList,
template: KoList.template
});
ko.components.register("ko-template", {
viewModel: KoTemplate,
template: KoTemplate.template
});
ko.components.register("ko-react-bridge", {
viewModel: KoReactBridge,
template: KoReactBridge.template
});
//let domElement = react.createElement("div");
//reactDOM.render(react.createElement(SomeComponentList), document.getElementById('react'));
//reactDOM.render(react.createElement(SomeKoComponentList), document.getElementById('react'));
//reactDOM.render(react.createElement(TestComponentFullSample), document.getElementById('react'));
ko.applyBindings({}, document.getElementsByClassName("knockout")[0]);
示例4: require
import 'bootstrap';
import 'bootstrap/dist/css/bootstrap.css';
import './css/site.css';
import * as ko from 'knockout';
import { createHistory } from 'history';
import './webpack-component-loader';
// Load and register the <app-root> component
ko.components.register('app-root', require('./components/app-root/app-root').default);
// Tell Knockout to start up an instance of your application
ko.applyBindings({ history: createHistory() });
// Basic hot reloading support. Automatically reloads and restarts the Knockout app each time
// you modify source files. This will not preserve any application state other than the URL.
declare var module: any;
if (module.hot) {
module.hot.accept();
module.hot.dispose(() => ko.cleanNode(document.body));
}
示例5: HelloViewModel
$(document).ready(() => ko.applyBindings(new HelloViewModel("TypeScript Ebosos1", "Knockout")));
示例6: resolve
this.viewModel.init().then(() => {
// applies bindings
ko.applyBindings(this.viewModel, element);
resolve();
});
示例7:
/// <reference path="./../references.d.ts" />
import * as ko from "knockout";
import * as $ from "jquery";
import * as bootstrap from "bootstrap";
import * as router from "./router";
// Components can be packaged as AMD modules, such as the following:
ko.components.register('nav-bar', { require: 'components/nav-bar/nav-bar' });
ko.components.register('home-page', { require: 'components/home-page/home' });
// ... or for template-only components, you can just point to a .html file directly:
ko.components.register('about-page', {
template: { require: 'text!components/about-page/about.html' }
});
// [Scaffolded component registrations will be inserted here. To retain this feature, don't remove this comment.]
// Start the application
ko.applyBindings({ route: router.currentRoute });
示例8: onShow
onShow() {
ko.applyBindings(this.viewModel, this.el);
}
示例9: constructor
import * as ko from "knockout";
class AppViewModel{
firstName: KnockoutObservable<string>
lastName: KnockoutObservable<string>
fullName: KnockoutComputed<string>
constructor(firstname: string, lastname: string){
this.firstName = ko.observable(firstname);
this.lastName = ko.observable(lastname);
this.fullName = ko.computed<string>(() => {
return this.firstName() + " " + this.lastName();
});
}
showname() {
return "the name is " + this.firstName() + " " + this.lastName();
}
}
ko.applyBindings(new AppViewModel("firstname default", "last name default"));
// other compute like pureComputed() which can set read, write and owner
示例10: constructor
import * as ko from 'knockout'
class HelloViewModel {
language: KnockoutObservable<string>
framework: KnockoutObservable<string>
constructor(langiage: string, framework: string) {
this.language = ko.observable(langiage)
this.framework = ko.observable(framework)
}
}
ko.applyBindings(new HelloViewModel('ts', 'knockout'))