本文整理汇总了TypeScript中@angular/upgrade.UpgradeAdapter.addProvider方法的典型用法代码示例。如果您正苦于以下问题:TypeScript UpgradeAdapter.addProvider方法的具体用法?TypeScript UpgradeAdapter.addProvider怎么用?TypeScript UpgradeAdapter.addProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/upgrade.UpgradeAdapter
的用法示例。
在下文中一共展示了UpgradeAdapter.addProvider方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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));
}
示例2: UpgradeAdapter
/*
* Create our upgradeAdapter
*/
const upgradeAdapter: UpgradeAdapter = new UpgradeAdapter();
/*
* Expose our ng2 content to ng1
*/
angular.module('interestApp')
.directive('pinControls',
upgradeAdapter.downgradeNg2Component(PinControlsComponent))
.directive('addPin',
upgradeAdapter.downgradeNg2Component(AddPinComponent));
upgradeAdapter.addProvider(AnalyticsService);
angular.module('interestApp')
.factory('AnalyticsService',
upgradeAdapter.downgradeNg2Provider(AnalyticsService));
/*
* Expose our ng1 content to ng2
*/
upgradeAdapter.upgradeNg1Provider('PinsService');
upgradeAdapter.upgradeNg1Provider('$state');
/*
* Bootstrap the App
*/
upgradeAdapter.bootstrap(document.body, ['interestApp']);
示例3: 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']);
示例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: UpgradeAdapter
import { UpgradeAdapter } from '@angular/upgrade';
import { HTTP_PROVIDERS } from '@angular/http';
import { Phone } from './core/phone/phone.service';
let upgradeAdapter = new UpgradeAdapter();
upgradeAdapter.addProvider(HTTP_PROVIDERS);
upgradeAdapter.addProvider(Phone);
angular.module('core.phone')
.factory('phone', upgradeAdapter.downgradeNg2Provider(Phone));
upgradeAdapter.bootstrap(document.documentElement, ['phonecatApp']);
示例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']);