• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript upgrade.UpgradeAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/upgrade.UpgradeAdapter的典型用法代码示例。如果您正苦于以下问题:TypeScript UpgradeAdapter类的具体用法?TypeScript UpgradeAdapter怎么用?TypeScript UpgradeAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UpgradeAdapter类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: UpgradeAdapter

// #docregion
import { UpgradeAdapter } from '@angular/upgrade';
import { NgModule, forwardRef } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { ContainerComponent } from './container.component';

export const upgradeAdapter = new UpgradeAdapter(forwardRef(() => AppModule));
const HeroDetail = upgradeAdapter.upgradeNg1Component('heroDetail');

@NgModule({
  imports: [ BrowserModule ],
  declarations: [ ContainerComponent, HeroDetail ]
})
export class AppModule {}

angular.module('heroApp', [])
  .controller('MainCtrl', function() {
    this.message = 'Hello world';
  });
开发者ID:MarkPieszak,项目名称:angular.io,代码行数:20,代码来源:upgrade_adapter.ts


示例2: UpgradeAdapter

import { BrowserModule } from '@angular/platform-browser';

import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { AppComponent } from './app.component';
import { AddPinComponent } from './add-pin/add-pin.component';
import { PinControlsComponent } from './pin-controls/pin-controls.component';
import { AnalyticsService } from './analytics.service';

declare var angular: any;

/*
 * Create our upgradeAdapter
 */
export const upgradeAdapter: UpgradeAdapter = new UpgradeAdapter(
  forwardRef(() => AppModule));

  /*
 * 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));

/*
开发者ID:borodovisin,项目名称:Books,代码行数:32,代码来源:app.module.ts


示例3: UpgradeAdapter

@NgModule({
  declarations: [
    DisplayNamePipe,
    UninvitedPipe,
    PartyDetails,
    PartyUninvited
  ],
  imports: [
    BrowserModule,
    FormsModule,
    MaterialModule
  ]
})
class AppNg2Module {}

const adapter = new UpgradeAdapter(AppNg2Module);

adapter.upgradeNg1Component('partyMap');

registerAuth(adapter);
registerLogin(adapter);
registerNavigation(adapter);
registerPartiesList(adapter);
registerPartiesMap(adapter);
registerPartiesSort(adapter);
registerPartyAdd(adapter);
registerPartyAddButton(adapter);
registerPartyCreator(adapter);
registerPartyDetails(adapter);
registerPartyImage(adapter);
registerPartyMap(adapter);
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:31,代码来源:main.ts


示例4: UpgradeAdapter

import {Component} from '@angular/core';
import {UpgradeAdapter} from '@angular/upgrade';
import {bootstrap} from '@angular/platform-browser-dynamic';
import {Algorithms} from './components/algorithms/algorithms';
import {Adder} from './components/adder/adder';
import {Counter} from './components/counter/counter';

declare var angular:any;

var adapter: UpgradeAdapter = new UpgradeAdapter();

angular.module('angular-legacy').directive('algorithms',adapter.downgradeNg2Component(Algorithms));
angular.module('angular-legacy').directive('add',adapter.downgradeNg2Component(Adder));
angular.module('angular-legacy').directive('counterButton',adapter.downgradeNg2Component(Counter));

adapter.bootstrap(document.body, ['angular-legacy']);
开发者ID:Domnom,项目名称:angular-2-samples,代码行数:16,代码来源:upgrade.ts


示例5: UpgradeAdapter

//ng1/2 hybrid
import * as angular from 'angular'
import { UpgradeAdapter } from '@angular/upgrade';
import { Ng2Component } from './ng2-app'

//vanilla ng1 module
const ng1Module = angular.module('ng1-module', []);

//upgrade adapter
const adapter = new UpgradeAdapter();

//vanilla ng1 root component
ng1Module.component('ng1RootComponent', {
	template: `
	  <div>ng1 app</div>
	  <input ng-model="ctrl.myName" />
	  <ng1-component name="ctrl.myName"></ng1-component>
	  <ng2-component [name]="ctrl.myName"></ng2-component>
	`,
	controller: function(){
		this.myName = 'bob'
	},
	controllerAs: 'ctrl'
});

//vanilla ng1 component
ng1Module.component('ng1Component', {
	template: `<div>hello {{ctrl.name}} from ng1!</div>`,
	bindings: {
		name: '='
	},
开发者ID:robwormald,项目名称:upgrade-demo,代码行数:31,代码来源:ng1-app.ts


示例6: UpgradeAdapter

// #docregion downgradecomponent
import {HeroDetailComponent} from './hero-detail.component';

// #enddocregion downgradecomponent
import {UpgradeAdapter} from '@angular/upgrade';

const upgradeAdapter = new UpgradeAdapter();

// #docregion downgradecomponent

angular.module('heroApp', [])
  .directive('heroDetail', upgradeAdapter.downgradeNg2Component(HeroDetailComponent));

// #enddocregion downgradecomponent

upgradeAdapter.bootstrap(
  document.querySelector('hero-app'),
  ['heroApp'],
  {strictDi: true}
);
// #enddocregion bootstrap
开发者ID:Xiahl1990,项目名称:angular.io,代码行数:21,代码来源:app.module.ts


示例7: 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


示例8: function

declare var angular:any;

// #docregion bootstrap
import { UpgradeAdapter } from '@angular/upgrade';

// #enddocregion bootstrap

angular.module('heroApp', [])
  .controller('MainCtrl', function() {
    this.message = 'Hello world';
  });

// #docregion bootstrap

const upgradeAdapter = new UpgradeAdapter();

upgradeAdapter.bootstrap(document.body, ['heroApp'], {strictDi: true});
// #enddocregion bootstrap
开发者ID:2947721120,项目名称:angular-cn-1,代码行数:18,代码来源:app.module.ts


示例9: setTimeout

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

  setTimeout(() => {
    ref.ng2Injector.get(Router).initialNavigation();
  }, 0);
};
开发者ID:vsavkin,项目名称:upgrade-demo,代码行数:7,代码来源:app.ts


示例10: onReady

function onReady() {
  adapter.bootstrap(document.body, [
    SociallyNg1Module.name
  ]);
}
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:5,代码来源:main.ts



注:本文中的@angular/upgrade.UpgradeAdapter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript angular_js.module函数代码示例发布时间:2022-05-28
下一篇:
TypeScript upgrade.downgradeComponent函数代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap