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

TypeScript static.downgradeInjectable函数代码示例

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

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



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

示例1: it

  it('should run all the tests, checking that the messages are right', (done) => {

    // TODO: ANG, once we get a pattern established, module creation should be extracted to helpers.js
    @NgModule({
      imports: [BrowserModule, UpgradeModule],
      providers: [
        DummyNg2Service
      ]
    })
    class TestModule {
      public ngDoBootstrap() {}
    }

    // TODO: ANG, once we get a pattern established, downgraded module creation should be extracted to helpers.js
    const mod: any =
      angular.module(DUMMY_NG2_SERVICE, []).factory(DUMMY_DOWNGRADE.injectionName, downgradeInjectable(DummyNg2Service));
    bootstrap(platformBrowserDynamic(), TestModule, html('<div>'), [mod.name, DUMMY_NG1_SERVICE])
      .then((upgrade) => {
        const injector: any = upgrade.$injector;
        const dummyNg2Service: DummyNg2Service = injector.get(DUMMY_DOWNGRADE.injectionName) as DummyNg2Service;
        expect(dummyNg2Service).toBeDefined();
        expect(dummyNg2Service.getMessage()).toBe('Dummy NG2 Service');

        const dummyNg1Service: DummyNg1Service = injector.get('dummyNg1Service') as DummyNg1Service;
        expect(dummyNg1Service).toBeDefined();
        expect(dummyNg1Service.getMessage()).toBe('Dummy NG1 Service');
        expect(dummyNg1Service.getInjectedMessage()).toBe('Dummy NG2 Service');
        done();
      });
  });
开发者ID:jtk54,项目名称:deck,代码行数:30,代码来源:dummyNg1.service.spec.ts


示例2: it

    it('should downgrade ng2 service to ng1', async(() => {
         // Tokens used in ng2 to identify services
         const Ng2Service = new OpaqueToken('ng2-service');

         // Sample ng1 NgModule for tests
         @NgModule({
           imports: [BrowserModule, UpgradeModule],
           providers: [
             {provide: Ng2Service, useValue: 'ng2 service value'},
           ]
         })
         class Ng2Module {
           ngDoBootstrap() {}
         }

         // create the ng1 module that will import an ng2 service
         const ng1Module =
             angular.module('ng1Module', []).factory('ng2Service', downgradeInjectable(Ng2Service));

         bootstrap(platformBrowserDynamic(), Ng2Module, html('<div>'), ng1Module)
             .then((upgrade) => {
               const ng1Injector = upgrade.$injector;
               expect(ng1Injector.get('ng2Service')).toBe('ng2 service value');
             });
       }));
开发者ID:awerlang,项目名称:angular,代码行数:25,代码来源:injection_spec.ts


示例3: removeEdge

  removeEdge(db, user, e){
    this.init(db, user);
    this.databases[db][user].data.edges = this.databases[db][user].data.edges.filter((edge) => {
      return edge["@rid"] !== e.edge["@rid"];
    })
  },
  removeVertex(db, user, v){
    this.init(db, user);
    this.databases[db][user].data.vertices = this.databases[db][user].data.vertices.filter((vertex) => {
      return vertex["@rid"] !== v["@rid"];
    })
  },
  data(db, user){
    this.init(db, user);
    return this.databases[db][user].data;
  },
  clear(db, user) {
    this.databases[db][user].data = {vertices: [], edges: []};
  }
});

angular.module('graph.services', []).factory(
  `GraphService`,
  downgradeInjectable(GraphService));

export  {GraphService};




开发者ID:orientechnologies,项目名称:orientdb-studio,代码行数:26,代码来源:graph.service.ts


示例4: downgradeInjectable

  .component('lMdContent', MdContentComponent)
  .component('lMdToolbar', MdToolbarComponent)
  .component('lMdSidenav', MdSidenavComponent)
  .component('lMdIcon', MdIconComponent)
  .component('lMdProgressLinear', MdProgressLinearComponent)
  .component('lMdCard', MdCardComponent)

  // angular 1 app services
  .service('lMenuService', MenuService)
  .service('lLineItemService', LineItemService)
  .service('lOrderService', OrderService)
  .service('lBasketService', BasketService)
  .service('lUserService', UserService)
  .service('lToastService', ToastService)
  .service('lPriceService', PriceService)
  .factory('router', downgradeInjectable(RouterWrapper))
  .factory('configService', downgradeInjectable(ConfigService))

  // angular 1 app filters
  .filter('lDate', DateFilter)

  // angular 2 app components to be used in angular 1 app
  .directive('lApp', downgradeComponent({component: AppComponent}) as angular.IDirectiveFactory)
  .directive('lExample', downgradeComponent({component: ExampleComponent}) as angular.IDirectiveFactory)
  .directive('lFlashMessage', downgradeComponent({component: FlashMessageComponent}) as angular.IDirectiveFactory)
  .directive('lPastDaysSwitcher', downgradeComponent({
    component: PastDaysSwitcherComponent,
    inputs: ['switched'],
    outputs: ['switch']
  }) as angular.IDirectiveFactory)
  .directive('lMenuCover', downgradeComponent({
开发者ID:lunches-platform,项目名称:fe,代码行数:31,代码来源:app.module.ts


示例5: transform

import {downgradeInjectable} from '@angular/upgrade/static';
import {Injectable} from "@angular/core";

declare var angular: any;

@Injectable()
export class FormatArrayPipe {

  transform(input) {
    if (input instanceof Array) {
      var output = "";
      input.forEach(function (e, idx) {
        output += (idx > 0 ? ", " : " ") + e;
      })
      return output;
    } else {
      return input;
    }
  }
}

angular.module('legacy.filters', []).factory(
  `FormatArrayPipe`,
  downgradeInjectable(FormatArrayPipe));

开发者ID:orientechnologies,项目名称:orientdb-studio,代码行数:24,代码来源:formatArray.pipe.ts


示例6: constructor

import { heroDetailComponent } from './hero-detail.component';

// #docregion ngmodule, register
import { Heroes } from './heroes';
// #enddocregion register

@NgModule({
  imports: [
    BrowserModule,
    UpgradeModule
  ],
  providers: [ Heroes ]
})
export class AppModule {
  constructor(private upgrade: UpgradeModule) { }
  ngDoBootstrap() {
    this.upgrade.bootstrap(document.body, ['heroApp'], { strictDi: true });
  }
}
// #enddocregion ngmodule
// #docregion register
import { downgradeInjectable } from '@angular/upgrade/static';

angular.module('heroApp', [])
  .factory('heroes', downgradeInjectable(Heroes))
  .component('heroDetail', heroDetailComponent);
// #enddocregion register

platformBrowserDynamic().bootstrapModule(AppModule);
开发者ID:AnthonyPAlicea,项目名称:angular,代码行数:29,代码来源:app.module.ts


示例7: HubConnection

        this._hubConnection = new HubConnection('/myvotehub');

        this._hubConnection.on('pollAdded',
            (...msg: any[]) => {
                if (this.pollAddedObserver) {
                    this.pollAddedObserver.next(msg[0]);
                }
            });

        this._hubConnection.start()
            .then(() => {
                console.log('MyVoteHub connection started');
            })
            .catch(err => {
                console.log('Error while establishing connection');
            });

        this.pollAddedChanged$ = new Observable((observer: any) => this.pollAddedObserver = observer).share();
    }

    public addPollNotification(): void {
        //Invoking 'AddPollAsync' method defined in SignalR hub
        this._hubConnection.invoke('AddPollAsync');
    }

}

angular.module('MyVoteApp')
    .factory('ngSignalRService', downgradeInjectable(SignalRService));
开发者ID:Magenic,项目名称:MyVote,代码行数:29,代码来源:signalr.service.ts


示例8: downgradeComponent

        outputs: ['checkedChange']
    }));
    SdcUiComponentsNg1Module.directive('sdcRadioGroup', downgradeComponent({
        component: Components.RadioGroupComponent,
        inputs: ['legend', 'options', 'disabled', 'value', 'direction'],
        outputs: ['valueChange']
    }));

    // Buttons
    SdcUiComponentsNg1Module.directive('sdcButton', downgradeComponent({
        component: Components.ButtonComponent,
        inputs: ['text', 'disabled', 'type', 'size', 'preventDoubleClick', 'icon_name', 'icon_positon']
    }));

    // Modals
    SdcUiComponentsNg1Module.service('SdcModalService', downgradeInjectable(Components.ModalService));
    SdcUiComponentsNg1Module.directive('sdcModal', downgradeComponent({
        component: Components.ModalComponent,
        inputs: ['size', 'title', 'message', 'buttons', 'type'],
        outputs: ['closeAnimationComplete']
    }));
    SdcUiComponentsNg1Module.directive('sdcModalButton', downgradeComponent({
        component: Components.ModalButtonComponent,
        inputs: ['callback', 'closeModal']
    }));

    // Notifications
    SdcUiComponentsNg1Module.service('SdcNotificationService', downgradeInjectable(Components.NotificationsService));
    SdcUiComponentsNg1Module.directive('sdcNotificationContainer', downgradeComponent({
        component: Components.NotificationContainerComponent
    }));
开发者ID:onap-sdc,项目名称:sdc-ui,代码行数:31,代码来源:ng1.module.ts


示例9: downgradeInjectable

SPINNAKER_DOWNGRADES.forEach((item) => {
  DOWNGRADED_MODULE_NAMES.push(item.moduleName);
  providers.push(item.moduleClass);
  angular.module(item.moduleName, []).factory(item.injectionName, downgradeInjectable(item.moduleClass));
});
开发者ID:jtk54,项目名称:deck,代码行数:5,代码来源:app.module.ts


示例10: status

  status() {
    let url = API + 'etl/status';
    return this.http.get(url).toPromise().then((data) => {
      return data.json();
    });
  }

  saveConfiguration(params) {
    let url = API + 'etl/save-config';
    return this.http.post(url, params).toPromise().then((data) => {
      return data.json();
    });
  }

  initDatabase2Configs() {
    let url = API + 'etl/list-configs';
    return this.http.post(url, undefined).toPromise().then((data) => {
      return data.json();
    });
  }

}


angular.module('command.services', []).factory(
  `EtlService`,
  downgradeInjectable(EtlService));

export {EtlService};
开发者ID:orientechnologies,项目名称:orientdb-studio,代码行数:29,代码来源:etl.service.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript static.UpgradeModule类代码示例发布时间:2022-05-28
下一篇:
TypeScript static.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