本文整理汇总了TypeScript中@angular/upgrade.UpgradeAdapter.downgradeNg2Provider方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UpgradeAdapter.downgradeNg2Provider方法的具体用法?TypeScript UpgradeAdapter.downgradeNg2Provider怎么用?TypeScript UpgradeAdapter.downgradeNg2Provider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/upgrade.UpgradeAdapter
的用法示例。
在下文中一共展示了UpgradeAdapter.downgradeNg2Provider方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: UpgradeAdapter
*/
const upgradeAdapter: UpgradeAdapter = new UpgradeAdapter(
forwardRef(() => InterestAppModule));
/*
* 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,
示例2: UpgradeAdapter
/**
* Created by ranwahle on 09/08/2016.
*/
import "angular";
import { UpgradeAdapter } from '@angular/upgrade';
import './app';
import {ChatService} from "./services/chatService";
let upgradeAdapter = new UpgradeAdapter();
upgradeAdapter.addProvider(ChatService);
angular.module('chatApp.chatService',[])
.service('chatService', upgradeAdapter.downgradeNg2Provider(ChatService));
upgradeAdapter.bootstrap(document.documentElement, ['chatApp']);
示例3: UpgradeAdapter
// #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
// #docregion phone-detail
angular.module('phoneDetail')
.directive(
'phoneDetail',
upgradeAdapter.downgradeNg2Component(PhoneDetailComponent) as angular.IDirectiveFactory
示例4: downgradeUtilitiesToAngular1
export function downgradeUtilitiesToAngular1(upgradeAdapter: UpgradeAdapter) {
const observableFactoryProvider: Provider = new Provider(observableToken, {
useValue: {
deps: [ExceptionHandler],
getInstance: (exceptionHandler: ExceptionHandler): IObservableService => new ObservableService(exceptionHandler),
},
})
// angular's http (distinct from ours below)
upgradeAdapter.addProvider(HTTP_PROVIDERS);
upgradeAdapter.addProvider(ARRAY_PROVIDER);
upgradeAdapter.addProvider(BOOLEAN_PROVIDER);
upgradeAdapter.addProvider(RESOURCE_BUILDER_PROVIDER);
upgradeAdapter.addProvider(DATE_PROVIDER);
upgradeAdapter.addProvider(DEFAULT_ERROR_PROVIDERS);
upgradeAdapter.addProvider(DEFAULT_LOGIN_URL_PROVIDERS);
upgradeAdapter.addProvider(ERROR_HANDLER_PROVIDER);
upgradeAdapter.addProvider(DIGEST_PROVIDER);
upgradeAdapter.addProvider(GENERIC_SEARCH_FILTER_PROVIDER);
upgradeAdapter.addProvider(GUID_PROVIDER);
upgradeAdapter.addProvider(HTTP_PROVIDER);
upgradeAdapter.addProvider(LOGGER_PROVIDER);
upgradeAdapter.addProvider(NOTIFICATION_PROVIDER);
upgradeAdapter.addProvider(NUMBER_PROVIDER);
upgradeAdapter.addProvider(OBJECT_PROVIDER);
upgradeAdapter.addProvider(observableFactoryProvider);
upgradeAdapter.addProvider(REDIRECT_PROVIDER);
upgradeAdapter.addProvider(STRING_PROVIDER);
upgradeAdapter.addProvider(SYNCHRONIZED_REQUESTS_PROVIDER);
upgradeAdapter.addProvider(TIME_PROVIDERS);
upgradeAdapter.addProvider(TimeoutService);
upgradeAdapter.addProvider(TIMEZONE_PROVIDER);
upgradeAdapter.addProvider(TRANSFORM_PROVIDER);
upgradeAdapter.addProvider(VALIDATION_PROVIDER);
upgradeAdapter.addProvider(WINDOW_PROVIDER);
utilitiesModule.filter(isEmptyFilterName, PipeDowngrader(new IsEmptyPipe(objectUtility)));
utilitiesModule.filter(truncateFilterName, PipeDowngrader(new TruncatePipe(objectUtility)));
utilitiesModule.factory(arrayServiceName, upgradeAdapter.downgradeNg2Provider(arrayToken));
utilitiesModule.factory(booleanServiceName, upgradeAdapter.downgradeNg2Provider(booleanToken));
utilitiesModule.factory(resourceBuilderServiceName, upgradeAdapter.downgradeNg2Provider(resourceBuilderToken));
utilitiesModule.factory(dateServiceName, upgradeAdapter.downgradeNg2Provider(dateToken));
utilitiesModule.factory(errorHandlerServiceName, upgradeAdapter.downgradeNg2Provider(errorHandlerToken));
utilitiesModule.factory(digestServiceName, upgradeAdapter.downgradeNg2Provider(digestToken));
utilitiesModule.factory(genericSearchFilterServiceName, upgradeAdapter.downgradeNg2Provider(genericSearchFilterToken));
utilitiesModule.factory(guidServiceName, upgradeAdapter.downgradeNg2Provider(guidToken));
utilitiesModule.factory(httpServiceName, upgradeAdapter.downgradeNg2Provider(httpToken));
utilitiesModule.factory(notificationServiceName, upgradeAdapter.downgradeNg2Provider(notificationToken));
utilitiesModule.factory(numberServiceName, upgradeAdapter.downgradeNg2Provider(numberToken));
utilitiesModule.factory(objectServiceName, upgradeAdapter.downgradeNg2Provider(objectToken));
utilitiesModule.factory(observableServiceName, upgradeAdapter.downgradeNg2Provider(observableToken));
utilitiesModule.factory(stringServiceName, upgradeAdapter.downgradeNg2Provider(stringToken));
utilitiesModule.factory(synchronizedRequestsServiceName, upgradeAdapter.downgradeNg2Provider(synchronizedRequestsToken));
utilitiesModule.factory(timeServiceName, upgradeAdapter.downgradeNg2Provider(TimeUtility));
utilitiesModule.factory(timeoutServiceName, upgradeAdapter.downgradeNg2Provider(TimeoutService));
utilitiesModule.factory(timezoneServiceName, upgradeAdapter.downgradeNg2Provider(timezoneToken));
utilitiesModule.factory(transformServiceName, upgradeAdapter.downgradeNg2Provider(transformToken));
utilitiesModule.factory(validationServiceName, upgradeAdapter.downgradeNg2Provider(validationToken));
}
示例5: downgradeUtilitiesToAngular1
export function downgradeUtilitiesToAngular1(upgradeAdapter: UpgradeAdapter) {
const observableFactoryProvider: Provider = new Provider(observableToken, {
useValue: {
deps: [ExceptionHandler],
getInstance: (exceptionHandler: ExceptionHandler): IObservableService => new ObservableService(exceptionHandler),
},
})
upgradeAdapter.addProvider(observableFactoryProvider);
upgradeAdapter.addProvider(UTILITY_PROVIDERS);
utilitiesModule.filter(isEmptyFilterName, PipeDowngrader(new IsEmptyPipe(objectUtility)));
utilitiesModule.filter(truncateFilterName, PipeDowngrader(new TruncatePipe(objectUtility)));
utilitiesModule.factory(arrayServiceName, upgradeAdapter.downgradeNg2Provider(ArrayUtility));
utilitiesModule.factory(booleanServiceName, upgradeAdapter.downgradeNg2Provider(BooleanUtility));
utilitiesModule.factory(resourceBuilderServiceName, upgradeAdapter.downgradeNg2Provider(ResourceBuilder));
utilitiesModule.factory(dateServiceName, upgradeAdapter.downgradeNg2Provider(DateUtility));
utilitiesModule.factory(errorHandlerServiceName, upgradeAdapter.downgradeNg2Provider(ErrorHandlerService));
utilitiesModule.factory(digestServiceName, upgradeAdapter.downgradeNg2Provider(DigestService));
utilitiesModule.factory(genericSearchFilterServiceName, upgradeAdapter.downgradeNg2Provider(GenericSearchFilterFactory));
utilitiesModule.factory(guidServiceName, upgradeAdapter.downgradeNg2Provider(GuidService));
utilitiesModule.factory(httpServiceName, upgradeAdapter.downgradeNg2Provider(HttpUtility));
utilitiesModule.factory(notificationServiceName, upgradeAdapter.downgradeNg2Provider(NotificationService));
utilitiesModule.factory(numberServiceName, upgradeAdapter.downgradeNg2Provider(NumberUtility));
utilitiesModule.factory(objectServiceName, upgradeAdapter.downgradeNg2Provider(ObjectUtility));
utilitiesModule.factory(observableServiceName, upgradeAdapter.downgradeNg2Provider(observableToken));
utilitiesModule.factory(stringServiceName, upgradeAdapter.downgradeNg2Provider(StringUtility));
utilitiesModule.factory(synchronizedRequestsServiceName, upgradeAdapter.downgradeNg2Provider(SynchronizedRequestsFactory));
utilitiesModule.factory(timeServiceName, upgradeAdapter.downgradeNg2Provider(TimeUtility));
utilitiesModule.factory(timeoutServiceName, upgradeAdapter.downgradeNg2Provider(TimeoutService));
utilitiesModule.factory(timezoneServiceName, upgradeAdapter.downgradeNg2Provider(TimezoneService));
utilitiesModule.factory(transformServiceName, upgradeAdapter.downgradeNg2Provider(TransformService));
utilitiesModule.factory(validationServiceName, upgradeAdapter.downgradeNg2Provider(ValidationService));
utilitiesModule.factory(emailValidationServiceName, upgradeAdapter.downgradeNg2Provider(EmailValidationService));
}
示例6: UpgradeAdapter
import { CarouselTitle } from './app/carousel-title/carousel-title';
import { KittensCarouselComponent, KITTENS_PROVIDERS } from './app/kittens-carousel/kittens-carousel';
import { StoreService } from './app/shared/store.service';
// enableProdMode()
// bootstrap(App, [
// HTTP_PROVIDERS,
// APP_ROUTER_PROVIDERS,
// { provide: LocationStrategy, useClass: HashLocationStrategy }
// ])
// .catch(err => console.error(err));
/*
* Create our upgradeAdapter
*/
const upgradeAdapter: UpgradeAdapter = new UpgradeAdapter();
upgradeAdapter.addProvider(KITTENS_PROVIDERS);
upgradeAdapter.addProvider(StoreService);
angular.module('cdl-kittens')
.directive('cdlCarouselTitle',
upgradeAdapter.downgradeNg2Component(CarouselTitle))
.directive('cdlKittensCarousel',
upgradeAdapter.downgradeNg2Component(KittensCarouselComponent))
.factory('store',
upgradeAdapter.downgradeNg2Provider(StoreService));
upgradeAdapter.bootstrap(document.body, ['cdl-kittens']);