本文整理汇总了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');
示例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
示例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,
]
示例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);
};