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


TypeScript UpgradeAdapter.upgradeNg1Provider方法代碼示例

本文整理匯總了TypeScript中@angular/upgrade.UpgradeAdapter.upgradeNg1Provider方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript UpgradeAdapter.upgradeNg1Provider方法的具體用法?TypeScript UpgradeAdapter.upgradeNg1Provider怎麽用?TypeScript UpgradeAdapter.upgradeNg1Provider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/upgrade.UpgradeAdapter的用法示例。


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

示例1: UpgradeAdapter

import { UpgradeAdapter } from '@angular/upgrade';
import { uiRouterNgUpgrade } from 'ui-router-ng1-to-ng2';
import { forwardRef } from '@angular/core';
import { Angular2UaaGatewayAppModule } from './app.ng2module';

export var upgradeAdapter: UpgradeAdapter = new UpgradeAdapter(forwardRef(() => Angular2UaaGatewayAppModule));
uiRouterNgUpgrade.setUpgradeAdapter(upgradeAdapter);
upgradeAdapter.upgradeNg1Provider('$stateParams');
upgradeAdapter.upgradeNg1Provider('$uibModal');
upgradeAdapter.upgradeNg1Provider('$state');
upgradeAdapter.upgradeNg1Provider('$rootScope');
upgradeAdapter.upgradeNg1Provider('tmhDynamicLocale');
開發者ID:xetys,項目名稱:jhipster-uaa-setup,代碼行數:12,代碼來源:upgrade_adapter.ts

示例2: UpgradeAdapter

// #enddocregion phone-service
// #docregion phone-list
import { PhoneListComponent } from './phone-list/phone-list.component';

// #enddocregion phone-list
// #docregion phone-detail
import { PhoneDetailComponent } from './phone-detail/phone-detail.component';

// #enddocregion phone-detail
// #docregion init-adapter
let upgradeAdapter = new UpgradeAdapter(AppModule);
// #enddocregion init-adapter

// #docregion routeparams
upgradeAdapter.upgradeNg1Provider('$routeParams');
// #enddocregion routeparams

// #docregion phone-service

angular.module('core.phone')
  .factory('phone', upgradeAdapter.downgradeNg2Provider(Phone));
// #enddocregion phone-service
// #docregion phone-list

angular.module('phoneList')
  .directive(
    'phoneList',
    upgradeAdapter.downgradeNg2Component(PhoneListComponent) as angular.IDirectiveFactory
  );
// #enddocregion phone-list
開發者ID:rahulchaturvedie,項目名稱:angular.io,代碼行數:30,代碼來源:main.ts

示例3:

 * Expose our ng2 content to ng1
 */
angular.module('interestApp')
  .directive('pinControls',
             upgradeAdapter.downgradeNg2Component(PinControlsComponent))
  .directive('addPin',
             upgradeAdapter.downgradeNg2Component(AddPinComponent));

angular.module('interestApp')
  .factory('AnalyticsService',
           upgradeAdapter.downgradeNg2Provider(AnalyticsService));

/*
 * Expose our ng1 content to ng2
 */
upgradeAdapter.upgradeNg1Provider('PinsService');
upgradeAdapter.upgradeNg1Provider('$state');

@NgModule({
  declarations: [
    PinControlsComponent,
    AddPinComponent
  ],
  imports: [
    CommonModule,
    BrowserModule,
    FormsModule
  ],
  providers: [
    AnalyticsService,
  ]
開發者ID:hixiaoguan,項目名稱:Ionic,代碼行數:31,代碼來源:app.ts

示例4: extract

  extract(url) {
    return url;
  }

  merge(url, whole) {
    return url;
  }
}

@NgModule({
  imports: [BrowserModule, RouterModule.forRoot(FISH_ROUTES, {useHash: true})],
  providers: [
    { provide: UrlHandlingStrategy, useClass: Ng1Ng2UrlHandlingStrategy }
  ],
  declarations: [DolphinCmp, WhaleCmp, ModuleRootCmp, BlankCmp]
})
class AppModule {}

export const adapter = new UpgradeAdapter(AppModule);

adapter.upgradeNg1Provider('urlService');
configureModuleRoot(adapter, FishModule);
export const bootstrap = (el) => {
  const ref = adapter.bootstrap(el, [ 'rootModule' ]);

  setTimeout(() => {
    ref.ng2Injector.get(Router).initialNavigation();
  }, 0);
};

開發者ID:vsavkin,項目名稱:upgrade-demo,代碼行數:29,代碼來源:app.ts


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