當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript core.provide函數代碼示例

本文整理匯總了TypeScript中ng-metadata/core.provide函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript provide函數的具體用法?TypeScript provide怎麽用?TypeScript provide使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了provide函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1:

import '../../node_modules/angular-material/angular-material.scss'
import './app.scss';

import * as angular from 'angular';
// import * as ngAria from 'angular-aria';
// import * as ngMessages from 'angular-messages';
import * as ngSanitize from 'angular-sanitize';
import * as ngMaterial from 'angular-material';
import '../assets/svg-assets.js';
import { provide } from 'ng-metadata/core';


import { AppComponent } from './app.component.ts';
import { Configure } from './app.config';

const ngMaterialSvg = 'material.svgAssetsCache';
export const AppModule = angular.module( 'app', [
    ngSanitize,
    // ngAria,
    ngMaterial,
    ngMaterialSvg
  ] )
  .config( Configure )
  .directive( ...provide( AppComponent ) );
開發者ID:elmariofredo,項目名稱:ngBigParty-II,代碼行數:24,代碼來源:app.ts

示例2:

import * as angular from "angular"; // import angular globally
import { provide } from "ng-metadata/core";

import { AppCmp } from "./components/my-app.component";

// return/export the module so you can later bootsrap it in the startup using ngMetadata
// define  'app'   module and register all  components  and  services  defined in other files imported above...
export const AppModule = angular.module( "app", [] )
  .directive( ...provide( AppCmp ) )
  .name
;
開發者ID:dmorosinotto,項目名稱:ng-metadata-quickstart,代碼行數:11,代碼來源:app.module.ts

示例3:

// import * as angular from "angular"; // deccoment to include in the bundle and define angular globally
import { provide } from "ng-metadata/core";

import { AppCmp } from "./components/my-app.component";
import { AskCmp } from "./components/ask.component";
import { QuestionSvc } from "./services/question.service";
import myapp from "../myapp"

// return/export the module so you can later bootsrap it in the startup using ngMetadata
// define  'app'   module and register all  components  and  services  defined in other files imported above...
export const AppModule = angular.module( "app", [ myapp ] )
  .directive( ...provide( AppCmp ) )
  .directive( ...provide( AskCmp ) )
  .service( ...provide( QuestionSvc ) )
  .name
;
開發者ID:dmorosinotto,項目名稱:TS_config,代碼行數:16,代碼來源:app.module.ts

示例4:

import * as angular from 'angular';
import { provide } from 'ng-metadata/core';
import {
  MarkForCheckComponent,
  DetachComponent,
  DataProvider,
  ChangeDetectorComponent,
  DataProvider2,
  ReattachComponent
} from './change-detector.component';


export const ChangeDetectorModule = angular
  .module( 'changeDetector', [] )
  .directive(...provide(ChangeDetectorComponent))
  .directive(...provide(MarkForCheckComponent))
  .directive(...provide(DetachComponent))
  .directive(...provide(ReattachComponent))
  .service(...provide(DataProvider))
  .service(...provide(DataProvider2))
  .name;

開發者ID:HansS,項目名稱:ng-metadata,代碼行數:21,代碼來源:index.ts

示例5:

// import * as ngMessages from 'angular-messages';
import * as ngSanitize from 'angular-sanitize';
import * as ngMaterial from 'angular-material';
import '../assets/svg-assets.js';
import { provide } from 'ng-metadata/core';


import { AppComponent } from './app.component.ts';
import { Configure } from './app.config';
import { AppService } from './app.service';
import { MapComponent } from './components/map/map.component';
import { MapHandlerDirective } from './components/map/map-handler.directive';
import { ProgramComponent } from './components/program/progam.component';
import { SpeakersComponent } from './components/speakers/speakers.component';

const ngMaterialSvg = 'material.svgAssetsCache';
export const AppModule = angular.module( 'app', [
    ngSanitize,
    // ngAria,
    ngMaterial,
    ngMaterialSvg
  ] )
  .config( Configure )
  .service( ...provide( AppService ) )
  .directive( ...provide( AppComponent ) )
  .directive( ...provide( MapComponent ) )
  .directive( ...provide( MapHandlerDirective ) )
  .directive( ...provide( ProgramComponent ) )
  .directive( ...provide( SpeakersComponent ) )
  ;
開發者ID:ngParty,項目名稱:ngBigParty-II,代碼行數:30,代碼來源:app.ts

示例6:

import * as ngAnimate from 'angular-animate';
import { provide } from 'ng-metadata/core';
import { CoreModule } from '../core/core.module';
import { PhoneDetailComponent } from './phone-detail.component';
import { phoneAnimation } from './phone.animation';

export const PhoneDetailModule = angular
  .module( 'phonecat.phoneDetail', [
    ngAnimate,
    CoreModule
  ] )
  .directive( ...provide( PhoneDetailComponent ) )
  .animation( '.phone', phoneAnimation )
  .name;
開發者ID:dmorosinotto,項目名稱:ng1-migration-workshop,代碼行數:14,代碼來源:phone-detail.module.ts

示例7: constructor

export class SomeClassToInstantiate{
  constructor(private $timeout:ng.ITimeoutService, private $log:ng.ILogService){}
  greetWithDelay(){ this.$timeout(()=>console.info('greetings from SomeClassToInstantiate with delay!'),1000)}
}

// this is just showcase how to define config for your app or if you are building 3rd party module
configureProviders.$inject = [ '$provide' ];
export function configureProviders( $provide ) {
    $provide.service( ...provide(NgRxStore, {useClass: NgRxStore}) )
    $provide.value( ...provide(DynamicValueToken, {useValue:'hello'}) );
    $provide.factory(...provide(SomeFactoryFnToken, { deps: ['$timeout', '$log'], useFactory: ($timeout, $log) => () => new SomeClassToInstantiate($timeout, $log) }));
}

export const Ng1LegacyModule = angular.module( 'LegacyNg1Module', [
  TabsModule,
  LifecycleHooksModule,
  ChangeDetectorModule,
  TitleHandlerModule
] )

  .directive( ...provide( ElementReadyDirective ) )

  .directive( ...provide( MyValidatorDirective ) )
  .directive( ...provide( MyFooDirective ) )
  .directive( ...provide( MyFormBridgeDirective ) )
  .directive( ...provide( MyDirectiveTesterDirective ) )
  .directive( ...provide( TesterComponent ) )
  .directive( ...provide( GlobalListenerDirective ) )
  .directive( ...provide( TesterAttrDirective ) )
  .name;
開發者ID:gamejolt,項目名稱:ng-metadata,代碼行數:30,代碼來源:index.ts

示例8: configureProviders

export function configureProviders( $provide ) {
    $provide.service( ...provide(NgRxStore, {useClass: NgRxStore}) )
    $provide.value( ...provide(DynamicValueToken, {useValue:'hello'}) );
    $provide.factory(...provide(SomeFactoryFnToken, { deps: ['$timeout', '$log'], useFactory: ($timeout, $log) => () => new SomeClassToInstantiate($timeout, $log) }));
}
開發者ID:gamejolt,項目名稱:ng-metadata,代碼行數:5,代碼來源:index.ts

示例9:

import { MyValidatorDirective } from './directives/my-validator.directive';
import { MyFooDirective } from './directives/my-foo.directive';
import { MyFormBridgeDirective } from './directives/my-form-bridge.directive';
import { MyDirectiveTesterDirective } from './directives/my-directive-tester.directive';
import { TesterAttrDirective } from './directives/my-tester.directive';
import { GlobalListenerDirective } from './directives/global-listener.directive';
import { TesterComponent } from './components/tester/tester.component';
export const AppModule = angular.module( 'app', [
  TabsModule,
  LifecycleHooksModule,
  ChangeDetectorModule,
  TitleHandlerModule
] )

  // we need to register the service manually
  .service( ...provide( Title ) )

  .directive( ...provide( TodoAppCmp ) )
  .directive( ...provide( AddTodoCmp ) )
  .directive( ...provide( TodoItemCmp ) )
  .filter( ...provide( RemainingTodosPipe ) )
  .service( ...provide( TodoStore ) )

  .directive( ...provide( ElementReadyDirective ) )

  .directive( ...provide( MyValidatorDirective ) )
  .directive( ...provide( MyFooDirective ) )
  .directive( ...provide( MyFormBridgeDirective ) )
  .directive( ...provide( MyDirectiveTesterDirective ) )
  .directive( ...provide( TesterComponent ) )
  .directive( ...provide( GlobalListenerDirective ) )
開發者ID:HansS,項目名稱:ng-metadata,代碼行數:31,代碼來源:index.ts


注:本文中的ng-metadata/core.provide函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。