本文整理汇总了TypeScript中@angular/core/src/facade/lang.isPresent函数的典型用法代码示例。如果您正苦于以下问题:TypeScript isPresent函数的具体用法?TypeScript isPresent怎么用?TypeScript isPresent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isPresent函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: bootstrap
export function bootstrap(
appComponentType: Type,
customAppProviders: Array<any> = null,
customComponentProviders: Array<any> = null): Promise<ComponentRef<any>> {
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appProviders: Array<any> = [
...NODE_APP_PROVIDERS,
new Provider(DOCUMENT, {
useFactory: (directiveResolver, sharedStylesHost) => {
// TODO(gdi2290): determine a better for document on the server
let selector = directiveResolver.resolve(appComponentType);
let serverDocument = DOM.createHtmlDocument();
let el = DOM.createElement(selector);
DOM.appendChild(serverDocument.body, el);
sharedStylesHost.addHost(serverDocument.head);
return serverDocument;
},
deps: [DirectiveResolver, NodeSharedStylesHost]
}),
...(isPresent(customAppProviders) ? customAppProviders : [])
];
let componentProviders: Array<any> = [
...(isPresent(customComponentProviders) ? customComponentProviders : [])
];
let platform = createPlatform(ReflectiveInjector.resolveAndCreate(NODE_APP_PLATFORM));
return coreLoadAndBootstrap(platform.injector, appComponentType);
}
示例2: buildNodeAppProviders
export function buildNodeAppProviders(document?: any, providers?: Array<any>): Array<any> {
return [
...NODE_APP_PROVIDERS,
(isPresent(document) && document) ? [
new Provider(DOCUMENT, {
useFactory: (sharedStylesHost) => {
sharedStylesHost.addHost(document.head);
return document;
},
deps: [NodeSharedStylesHost]
})
] : [],
...(isPresent(providers) && providers) ? providers : []
];
}
示例3: buildNodePlatformProviders
export function buildNodePlatformProviders(
appComponentType: Type,
providers?: Array<any>): Array<any> {
return [
...NODE_APP_PLATFORM,
...(isPresent(providers) ? providers : [])
];
}
示例4: transform
transform(todos, args) {
let data = [];
if(todos){
data = todos.toArray();
}
if (isPresent(data) && !isArray(data)) {
throw new BaseException('VisibleTodos pipe requires an Array as input');
}
return this.getVisibleTodos(data, args);
}
示例5: bootstrap
private bootstrap(component: Type,
providers: Providers,
options: ServerOptions) {
let doc = this.createDoc(component);
let customProviders = buildNodeAppProviders(doc, this.getAppProviders(options));
customProviders = isPresent(providers) ? [...providers, ...customProviders]
: customProviders;
let bootstrapping = MeteorApp.bootstrap(component, buildNodeProviders(), customProviders);
return bootstrapping.then(compRef => ({
appRef: compRef.injector.get(ApplicationRef),
compRef
}));
}
示例6: ngDoCheck
ngDoCheck() {
if(!this.subscribed && isPresent(this.stream$)) {
this.stream$.subscribe((e) => {
this.materialized = false;
});
this.subscribed = true;
console.log('mater subscribed!');
}
if (!this.materialized && $('.dropdown-button').length > 0) {
$('.dropdown-button').dropdown({});
this.materialized = true;
console.log('materialized!');
}
}
示例7: customBootstrap
export function customBootstrap(appComponentType: any, customProviders: Provider[] = null): Promise<ComponentRef<any>> {
CustomDomAdapter.makeCurrent();
let logger = {
logGroup: () => {
console.log('---');
},
logError: (error: Error) => {
console.error(error);
},
logGroupEnd: () => {
console.log('---');
}
};
let platformProviders = [
PLATFORM_COMMON_PROVIDERS,
provide(XHR, { useClass: XHRShim }),
provide(ExceptionHandler, { useFactory: () => new ExceptionHandler(logger, true), deps: [] })
];
let appProviders = [
APPLICATION_COMMON_PROVIDERS,
COMPILER_PROVIDERS,
SanitizationService,
CustomRootRenderer,
provide(RootRenderer, { useClass: CustomRootRenderer }),
CustomRenderer,
provide(Renderer, { useClass: CustomRenderer })
];
if (customProviders) {
appProviders.push(customProviders);
}
let platform = getPlatform();
if (!isPresent(platform)) {
platform = createPlatform(ReflectiveInjector.resolveAndCreate(platformProviders));
}
reflector.reflectionCapabilities = new ReflectionCapabilities();
let appInjector = ReflectiveInjector.resolveAndCreate(appProviders, platform.injector);
return coreLoadAndBootstrap(appInjector, appComponentType);
}
示例8: transform
transform(value:string, args:any[]):any {
this.length = isPresent(args[0]) ? args[0] : 100;
this.placeholderEnd = (value.length < this.length) ? '' : isPresent(args[1]) ? args[1] : ' ...';
return value.substring(0, this.length).concat(this.placeholderEnd);
}
示例9: buildNodeProviders
export function buildNodeProviders(providers?: Array<any>): Array<any> {
return [
...NODE_APP_PLATFORM,
...(isPresent(providers) ? providers : [])
];
}
示例10: _dispose
_dispose(): void {
if (isPresent(this.iconSub)) {
this.iconSub.unsubscribe();
this.iconSub = undefined;
}
}