當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。