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


TypeScript angular.bootstrap函數代碼示例

本文整理匯總了TypeScript中angular.bootstrap函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript bootstrap函數的具體用法?TypeScript bootstrap怎麽用?TypeScript bootstrap使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了bootstrap函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it('.service should have right return type', (done) => {
        // NOTICE: Manual testing in VSCode with mouse hover
        module.config(($provide: Provide) => {

            // Should have type of Provider<any>
            const provider0 = $provide.service('customService0', MyServiceFn)

            // Should have type of Provider<MyServiceClass>
            const provider1 = $provide.service('customService1', MyServiceClass)

            // Should have type of Provider<any>
            const provider2 = $provide.service('customService2', ['$controller', MyServiceFn])

            // Should have type of Provider<MyServiceClass>
            const provider3 = $provide.service('customService3', ['$controller', MyServiceClass])
        }).run((customService0, customService1, customService2, customService3) => {
            expect(customService0 instanceof MyServiceFn).toBeTruthy()
            expect(customService1 instanceof MyServiceClass).toBeTruthy()
            expect(customService2 instanceof MyServiceFn).toBeTruthy()
            expect(customService3 instanceof MyServiceClass).toBeTruthy()

            done()
        })

        angular.bootstrap(element, ['custom'])
    })
開發者ID:trotyl,項目名稱:typed-angular,代碼行數:26,代碼來源:provide.spec.ts

示例2: InitEnvironment

InitEnvironment(() => {
    let app = angular.module('app', [angularUiRouter as string , angularMaterial as string]);
    Registe(app, AppController);
    Registe(app, Config);
    Registe(app, Router);
    angular.bootstrap(document.documentElement, ['app']);
});
開發者ID:AepKill,項目名稱:Typescript-Angular1.x-Template,代碼行數:7,代碼來源:app.ts

示例3: beforeEach

 beforeEach(inject( function ($rootScope, $compile) {
     scope = $rootScope.$new();
     element = angular.element('<div main-directive></div>');
     angular.bootstrap(element[0],['testModule']);
     element = $compile(element)(scope);
     scope.$digest();
 }));
開發者ID:bestander,項目名稱:webpack-typescript-angular,代碼行數:7,代碼來源:main-directive.spec.ts

示例4: it

  it('destroys the angular scope and empties the targetDomElement if angular is bootstraped to targetDomElement', () => {
    const targetDomElement = document.createElement('div');
    const scopeDestroySpy = jest.fn();

    const legacyPlatform = new LegacyPlatformService({
      ...defaultParams,
      targetDomElement,
    });

    // simulate bootstraping with a module "foo"
    angular.module('foo', []).directive('bar', () => ({
      restrict: 'E',
      link($scope) {
        $scope.$on('$destroy', scopeDestroySpy);
      },
    }));

    targetDomElement.innerHTML = `
      <bar></bar>
    `;

    angular.bootstrap(targetDomElement, ['foo']);

    legacyPlatform.stop();

    expect(targetDomElement).toMatchSnapshot();
    expect(scopeDestroySpy).toHaveBeenCalledTimes(1);
  });
開發者ID:rashidkpc,項目名稱:kibana,代碼行數:28,代碼來源:legacy_platform_service.test.ts

示例5: it

 it('should not define angular builtins before the app is bootstrapped', () => {
   const element = div()
   module('a', ['bcherny/ngimport'])
   expect($http).toBeUndefined()
   expect($rootScope).toBeUndefined()
   bootstrap(element, ['a'])
   element.remove()
 })
開發者ID:bcherny,項目名稱:ngimport,代碼行數:8,代碼來源:test.ts

示例6: onInit

 this._loadRequiredComponents(() => {
     this._angularConfig();
     this._angularRun();
     // start angular app
     angular.bootstrap(document, [APP_NAME]);
     // invoke initialization event
     if (undefined != onInit) {
         onInit();
     }
 });
開發者ID:dgzornoza,項目名稱:angular-typescript-seed,代碼行數:10,代碼來源:main.ts


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