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


TypeScript source_module.moduleRef函數代碼示例

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


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

示例1: it

 it('should dedupe imports', () => {
   var sourceWithImports =
       new SourceModule(
           'package:some/moda',
           `${moduleRef('package:some/modb')}A + ${moduleRef('package:some/modb')}B`)
           .getSourceWithImports();
   expect(sourceWithImports.source).toEqual('import0.A + import0.B');
   expect(sourceWithImports.imports).toEqual([['package:some/modb', 'import0']]);
 });
開發者ID:LordBinary,項目名稱:angular,代碼行數:9,代碼來源:source_module_spec.ts

示例2: moduleRef

  DirectiveIndex,
  Locals,
  BindingTarget,
  ChangeDetector
} from 'angular2/src/core/change_detection/change_detection';

import {evalModule} from './eval_module';

import {TEST_PROVIDERS} from './test_bindings';
import {TestDispatcher, TestPipes} from './change_detector_mocks';
import {codeGenValueFn, codeGenExportVariable, MODULE_SUFFIX} from 'angular2/src/compiler/util';

// Attention: These module names have to correspond to real modules!
var THIS_MODULE_ID = 'angular2/test/compiler/change_detector_compiler_spec';
var THIS_MODULE_URL = `package:${THIS_MODULE_ID}${MODULE_SUFFIX}`;
var THIS_MODULE_REF = moduleRef(THIS_MODULE_URL);

export function main() {
  describe('ChangeDetectorCompiler', () => {
    beforeEachProviders(() => TEST_PROVIDERS);

    var parser: TemplateParser;
    var compiler: ChangeDetectionCompiler;

    beforeEach(inject([TemplateParser, ChangeDetectionCompiler], (_parser, _compiler) => {
      parser = _parser;
      compiler = _compiler;
    }));

    describe('compileComponentRuntime', () => {
      function detectChanges(compiler: ChangeDetectionCompiler, template: string,
開發者ID:mixed,項目名稱:angular,代碼行數:31,代碼來源:change_detector_compiler_spec.ts

示例3: moduleRef

  BeginComponentCmd,
  EmbeddedTemplateCmd,
  TemplateCmd,
  visitAllCommands,
  CompiledComponentTemplate
} from 'angular2/src/core/linker/template_commands';

import {Component, View, Directive, provide} from 'angular2/core';

import {TEST_PROVIDERS} from './test_bindings';
import {TestDispatcher, TestPipes} from './change_detector_mocks';
import {codeGenValueFn, codeGenExportVariable, MODULE_SUFFIX} from 'angular2/src/compiler/util';

// Attention: This path has to point to this test file!
const THIS_MODULE_ID = 'angular2/test/compiler/template_compiler_spec';
var THIS_MODULE_REF = moduleRef(`package:${THIS_MODULE_ID}${MODULE_SUFFIX}`);

export function main() {
  describe('TemplateCompiler', () => {
    var compiler: TemplateCompiler;
    var runtimeMetadataResolver: RuntimeMetadataResolver;

    beforeEachBindings(() => TEST_PROVIDERS);
    beforeEach(inject([TemplateCompiler, RuntimeMetadataResolver],
                      (_compiler, _runtimeMetadataResolver) => {
                        compiler = _compiler;
                        runtimeMetadataResolver = _runtimeMetadataResolver;
                      }));

    describe('compile templates', () => {
開發者ID:TedSander,項目名稱:angular,代碼行數:30,代碼來源:template_compiler_spec.ts


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