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


TypeScript lang.isPresent函数代码示例

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

示例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 : []
  ];
}
开发者ID:BerniceChua,项目名称:landr,代码行数:15,代码来源:node.ts

示例3: buildNodePlatformProviders

export function buildNodePlatformProviders(
  appComponentType: Type,
  providers?: Array<any>): Array<any> {

  return [
    ...NODE_APP_PLATFORM,
    ...(isPresent(providers) ? providers : [])
  ];
}
开发者ID:BerniceChua,项目名称:landr,代码行数:9,代码来源:node.ts

示例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);
 }
开发者ID:chgc,项目名称:Angular2WithRedux,代码行数:10,代码来源:visiblefilter.ts

示例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
   }));
 }
开发者ID:Hongbo-Miao,项目名称:angular2-meteor-universal,代码行数:13,代码来源:bootloader.ts

示例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!');
    }
  }
开发者ID:gotascii,项目名称:gear_list_browser_client,代码行数:15,代码来源:materialize-dropdown-stream.directive.ts

示例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);
}
开发者ID:chrisber,项目名称:angular2-renderer-example,代码行数:44,代码来源:custom-bootstrap.ts

示例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);
 }
开发者ID:node-package,项目名称:dashboard,代码行数:5,代码来源:atexo-trancate.pipe.ts

示例9: buildNodeProviders

export function buildNodeProviders(providers?: Array<any>): Array<any> {
  return [
    ...NODE_APP_PLATFORM,
    ...(isPresent(providers) ? providers : [])
  ];
}
开发者ID:BerniceChua,项目名称:landr,代码行数:6,代码来源:node.ts

示例10: _dispose

 _dispose(): void {
   if (isPresent(this.iconSub)) {
     this.iconSub.unsubscribe();
     this.iconSub = undefined;
   }
 }  
开发者ID:arnaudvalle,项目名称:nativescript-ng2-fonticon,代码行数:6,代码来源:fonticon.pipe.ts


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