本文整理汇总了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;未经允许,请勿转载。 |
请发表评论