当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript knockout.applyBindings函数代码示例

本文整理汇总了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);
 }
开发者ID:saeed-ahmed,项目名称:CCTracking,代码行数:6,代码来源:BookingLeftCtrl.ts

示例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'});

开发者ID:xiangnanyue,项目名称:mygit2,代码行数:29,代码来源:bindings1.ts

示例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]);
开发者ID:Metal10k,项目名称:knockout-react-sample,代码行数:30,代码来源:index.ts

示例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));
}
开发者ID:An0564,项目名称:JavaScriptServices,代码行数:20,代码来源:boot.ts

示例5: HelloViewModel

$(document).ready(() => ko.applyBindings(new HelloViewModel("TypeScript Ebosos1", "Knockout")));
开发者ID:duskjet,项目名称:dyysh,代码行数:1,代码来源:main.ts

示例6: resolve

 this.viewModel.init().then(() => {
   // applies bindings
   ko.applyBindings(this.viewModel, element);
   resolve();
 });
开发者ID:,项目名称:,代码行数:5,代码来源:

示例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 });
开发者ID:chiyiangel,项目名称:generator-ko-ts,代码行数:20,代码来源:startup.ts

示例8: onShow

 onShow() {
     ko.applyBindings(this.viewModel, this.el);
 }
开发者ID:kashifjawed,项目名称:CCTracking,代码行数:3,代码来源:PaymentView.ts

示例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
开发者ID:xiangnanyue,项目名称:mygit2,代码行数:23,代码来源:computedOb.ts

示例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'))
开发者ID:Wayley,项目名称:ts-tutorial,代码行数:13,代码来源:hello.ts


注:本文中的knockout.applyBindings函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。