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


TypeScript UpgradeAdapter.addProvider方法代碼示例

本文整理匯總了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));
}
開發者ID:arknotts,項目名稱:TypeScript-Angular-Utilities,代碼行數:37,代碼來源:utilitiesDowngrade.ts

示例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']);
開發者ID:GerbenRampaart,項目名稱:ngbook2,代碼行數:29,代碼來源:app.ts

示例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']);
開發者ID:ranwahle,項目名稱:FrontEndIL_Migration,代碼行數:18,代碼來源:main.ts

示例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));
}
開發者ID:JamieBowen,項目名稱:TypeScript-Angular-Utilities,代碼行數:61,代碼來源:utilitiesDowngrade.ts

示例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']);
開發者ID:craigshoemaker,項目名稱:angular-phonecat-demo,代碼行數:12,代碼來源:main.ts

示例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']);
開發者ID:Arahir,項目名稱:hybrid-app,代碼行數:30,代碼來源:main.browser.ts


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