本文整理匯總了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;
}
}