本文整理汇总了TypeScript中angular2/src/core/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']]);
});
示例2: moduleRef
} 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/core/compiler/util';
// Attention: These module names have to correspond to real modules!
var THIS_MODULE_ID = 'angular2/test/core/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', () => {
beforeEachBindings(() => 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,
示例3: moduleRef
} 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/core/compiler/util';
import {APP_ID} from 'angular2/src/core/application_tokens';
// Attention: This path has to point to this test file!
const THIS_MODULE_ID = 'angular2/test/core/compiler/template_compiler_spec';
var THIS_MODULE_REF = moduleRef(`package:${THIS_MODULE_ID}${MODULE_SUFFIX}`);
const APP_ID_VALUE = 'app1';
export function main() {
describe('TemplateCompiler', () => {
var compiler: TemplateCompiler;
var runtimeMetadataResolver: RuntimeMetadataResolver;
beforeEachBindings(() => [provide(APP_ID, {useValue: APP_ID_VALUE}), TEST_PROVIDERS]);
beforeEach(inject([TemplateCompiler, RuntimeMetadataResolver],
(_compiler, _runtimeMetadataResolver) => {
compiler = _compiler;
runtimeMetadataResolver = _runtimeMetadataResolver;
}));