當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript angular2.bind函數代碼示例

本文整理匯總了TypeScript中angular2/angular2.bind函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript bind函數的具體用法?TypeScript bind怎麽用?TypeScript bind使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了bind函數的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: beforeEachBindings

		beforeEachBindings(() => [
			BaseRequestOptions,
			MockBackend,
			bind(Http).toFactory((connectionBackend: ConnectionBackend, defaultOptions: BaseRequestOptions) => {
				return new Http(connectionBackend, defaultOptions);
			}, [
				MockBackend,
				BaseRequestOptions
			]),
			bind(IconStore).toClass(IconStore, [
				Http
			])
		]);
開發者ID:Luphia,項目名稱:Laria,代碼行數:13,代碼來源:logo.spec.ts

示例2: beforeEach

		beforeEach(() => {
			injector = Injector.resolveAndCreate([
				BaseRequestOptions,
				MockBackend,
				bind(Http).toFactory((connectionBackend: ConnectionBackend, defaultOptions: BaseRequestOptions) => {
					return new Http(connectionBackend, defaultOptions);
				}, [
					MockBackend,
					BaseRequestOptions
				]),
				bind(IconStore).toClass(IconStore, [
					Http
				])
			]);
			backend = injector.get(MockBackend);
			store = injector.get(IconStore);
			response = new Response({ body: SVG_GLYPH_HTML });
			glyph = createGlyphNode();
		});
開發者ID:Luphia,項目名稱:Laria,代碼行數:19,代碼來源:icon.spec.ts

示例3: function

	AppRegistry.registerRunnable(appName, function() {
		CustomParse5DomAdapter.makeCurrent();

		bootstrap(component, [
			ReactNativeRenderer,
			bind(Renderer).toAlias(ReactNativeRenderer)
		].concat(bindings)).then(function(appRef) {
			var zone = appRef._injector.get(NgZone)._innerZone;
			require('ReactUpdates').batchedUpdates = zone.bind(require('ReactUpdates').batchedUpdates);
		});
	});
開發者ID:gitter-badger,項目名稱:react-native-renderer,代碼行數:11,代碼來源:angular_reactnative.ts

示例4: bind

/// <reference path="../typings/_custom.d.ts" />
import {bind} from 'angular2/angular2';
import {
  ChangeDetection,
  DynamicChangeDetection,
  JitChangeDetection,
  PreGeneratedChangeDetection
} from 'angular2/change_detection';

export var jitInjectables = [
  bind(ChangeDetection).toClass(JitChangeDetection)
];

export var dynamicInjectables = [
  bind(ChangeDetection).toClass(DynamicChangeDetection)
];

export var preGeneratedInjectables = [
  bind(ChangeDetection).toClass(PreGeneratedChangeDetection)
];

export var bestChangeDetectionInjectables = [
  PreGeneratedChangeDetection.isSupported() ? preGeneratedInjectables :
  JitChangeDetection.isSupported() ? jitInjectables : dynamicInjectables
];
開發者ID:danhamlin,項目名稱:angular2-webpack-starter,代碼行數:25,代碼來源:changeDetectionInjectables.ts

示例5: main

export function main() {
  return bootstrap(AppCmp, [bind(APP_BASE_HREF).toValue('/angular2/examples/router/ts/reuse')]);
}
開發者ID:hankduan,項目名稱:angular,代碼行數:3,代碼來源:reuse_example.ts

示例6: Component

import {Component, View, Directive, bootstrap, bind, NgFor, NgIf} from "angular2/angular2";

class Service {
	
}
class Service2 {
  
}

class Cmp {
	static annotations: any[];
}
Cmp.annotations = [
  Component({
    selector: 'cmp',
    injectables: [Service, bind(Service2).toValue(null)]
  }),
  View({
    template: '{{greeting}} world!',
    directives: [NgFor, NgIf]
  }),
  Directive({
    selector: '[tooltip]',
    properties: [
      'text: tooltip'
    ],
    hostListeners: {
      'onmouseenter': 'onMouseEnter()',
      'onmouseleave': 'onMouseLeave()'
    }
  })
開發者ID:GMouron,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:angular2-tests.ts

示例7: bootstrap

import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_BINDINGS, ROUTER_PRIMARY_COMPONENT} from 'angular2/router';
// import {HTTP_BINDINGS} from 'http/http';

import {OffersComponent} from './components/offers/OffersComponent';
import {CartComponent} from './components/cart/CartComponent';
import {RegistrationComponent} from './components/registration/RegistrationComponent';
import {UsersComponent} from './components/user/UsersComponent';

//import {HotelbookingServiceImpl} from './services/HotelbookingServiceImpl';

@Component({
  selector: 'app',
  //viewProviders: [HotelbookingService],
  templateUrl: './app.html',
  encapsulation: ViewEncapsulation.None,
  directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
  { path: '/', component: OffersComponent, as: 'Offers' },
  { path: '/cart', component: CartComponent, as: 'Cart' },
  { path: '/registration', component: RegistrationComponent, as: 'Registration' },
  { path: '/users', component: UsersComponent, as: 'Users' },
  { path: '/users/:id', component: UsersComponent, as: 'UserEdit' }
])
class App {}

bootstrap(App, [
  ROUTER_BINDINGS,
  bind(ROUTER_PRIMARY_COMPONENT).toValue(App)
]);
開發者ID:Anhmike,項目名稱:hotelbooking-angular2,代碼行數:30,代碼來源:app.ts

示例8: isObservable

import {Observable} from "rx";

function isObservable(obs: any): boolean {
  return obs && typeof obs.subscribe === "function";
}

class RxStrategy {
  createSubscription(async: any, updateLatestValue: any): any {
    return async.subscribe(updateLatestValue, (e: Error) => { throw e; });
  }
  dispose(subscription: any): void { subscription.dispose(); }
  onDestroy(subscription: any): void { subscription.dispose(); }
}

let _rxStrategy: RxStrategy = new RxStrategy();

@Pipe({name: "rx"})
export class RxPipe extends AsyncPipe {
  constructor(public _ref: ChangeDetectorRef) { super(_ref); }

  supports(obs: any): boolean { return isObservable(obs); }

  _selectStrategy(obj: Observable<any>): any {
    return _rxStrategy;
  }
}

export var rxPipeInjectables: Array<any> = [
  bind(RxPipe).toValue(RxPipe)
];
開發者ID:ArtemK-in6k,項目名稱:ng-book2,代碼行數:30,代碼來源:RxPipe.ts

示例9: constructor

/// <reference path="../../typings/_custom.d.ts" />
import {bind, Injectable} from 'angular2/angular2';

@Injectable()
export class Message {
  message: Array<string>;

  constructor() {
    this.message = ('TIME FLIES LIKE AN ARROW').split('');
  }

}


export var MESSAGE_BINDINGS: Array<any> = [
  bind(Message).toClass(Message)
];
開發者ID:jimthedev,項目名稱:angular2-webpack-starter,代碼行數:17,代碼來源:Message.ts

示例10: Boolean

import { ShadowDomStrategy, NativeShadowDomStrategy } from 'angular2/render';
import { bind } from 'angular2/angular2';
import { document } from 'angular2/src/facade/browser';

export var supportsNativeShadowDOM: boolean = Boolean(document && document.body && document.body.createShadowRoot);

export var shadowDomInjectables: Array<any> = !supportsNativeShadowDOM ? [] : [
	bind(ShadowDomStrategy).toClass(NativeShadowDomStrategy)
];
開發者ID:khalla,項目名稱:ng2-play,代碼行數:9,代碼來源:shadow_dom.ts


注:本文中的angular2/angular2.bind函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。