本文整理汇总了TypeScript中angular2/src/facade/collection.MapWrapper.createFromStringMap方法的典型用法代码示例。如果您正苦于以下问题:TypeScript MapWrapper.createFromStringMap方法的具体用法?TypeScript MapWrapper.createFromStringMap怎么用?TypeScript MapWrapper.createFromStringMap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/facade/collection.MapWrapper
的用法示例。
在下文中一共展示了MapWrapper.createFromStringMap方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: testChangeDetector
function testChangeDetector(changeDetectorFactory: Function): string[] {
var ctx = new TestContext();
ctx.someProp = 'someCtxValue';
var dir1 = new TestContext();
dir1.someProp = 'someDirValue';
var dispatcher = new TestDispatcher([dir1], []);
var cd = changeDetectorFactory(dispatcher);
var locals = new Locals(null, MapWrapper.createFromStringMap({'someVar': null}));
cd.hydrate(ctx, locals, dispatcher, new TestPipes());
cd.detectChanges();
return dispatcher.log;
}
示例2:
var decoratorWithMultipleAttrs = RenderDirectiveMetadata.create({
selector: 'input[type=text][control]',
id: 'decoratorWithMultipleAttrs',
type: RenderDirectiveMetadata.DIRECTIVE_TYPE
});
var someDirectiveWithProps = RenderDirectiveMetadata.create({
selector: '[some-decor-props]',
properties: ['dirProp: elProp'],
readAttributes: ['some-attr']
});
var someDirectiveWithHostProperties = RenderDirectiveMetadata.create({
selector: '[some-decor-with-host-props]',
host: MapWrapper.createFromStringMap<string>({'[hostProp]': 'dirProp'})
});
var someDirectiveWithInvalidHostProperties = RenderDirectiveMetadata.create({
selector: '[some-decor-with-invalid-host-props]',
host: MapWrapper.createFromStringMap<string>({'[hostProp]': 'dirProp + dirProp2'})
});
var someDirectiveWithHostAttributes = RenderDirectiveMetadata.create({
selector: '[some-decor-with-host-attrs]',
host: MapWrapper.createFromStringMap<string>({'attr_name': 'attr_val', 'class': 'foo bar'})
});
var someDirectiveWithEvents = RenderDirectiveMetadata.create({
selector: '[some-decor-events]',
host: MapWrapper.createFromStringMap<string>({'(click)': 'doIt()'})
示例3: captureDirective
captureDirective(DirectiveWithBind).then((renderDir) => {
expect(renderDir.bind).toEqual(MapWrapper.createFromStringMap({'a': 'b'}));
async.done();
});
示例4: DirectiveMetadata
var someViewport = new DirectiveMetadata({
selector: '[some-vp]',
id: 'someViewport',
type: DirectiveMetadata.VIEWPORT_TYPE
});
var someViewport2 = new DirectiveMetadata({
selector: '[some-vp2]',
id: 'someViewport2',
type: DirectiveMetadata.VIEWPORT_TYPE
});
var someDecorator = new DirectiveMetadata({selector: '[some-decor]'});
var someDecoratorIgnoringChildren = new DirectiveMetadata({
selector: '[some-decor-ignoring-children]',
compileChildren: false
});
var someDecoratorWithProps = new DirectiveMetadata({
selector: '[some-decor-props]',
bind: MapWrapper.createFromStringMap({
'dirProp': 'elProp',
'doubleProp': 'elProp | double'
}),
setters: ['value'],
readAttributes: ['some-attr']
});
var someDecoratorWithEvents = new DirectiveMetadata({
selector: '[some-decor-events]',
events: MapWrapper.createFromStringMap({'click': 'doIt()'})
});
//# sourceMappingURL=directive_parser_spec.js.map
//# sourceMappingURL=./directive_parser_spec.map
示例5: it
it('should add variable mappings from the template attribute to the nestedProtoView', () => {
var rootElement = el('<div><div *foreach="var varName=mapName"></div></div>');
var results = createPipeline().process(rootElement);
expect(results[2].inheritedProtoView.variableBindings)
.toEqual(MapWrapper.createFromStringMap({'mapName': 'varName'}));
});
示例6: expect
.then((protoView) => {
expect(protoView.variableBindings)
.toEqual(MapWrapper.createFromStringMap({'a': 'b'}));
async.done();
});
示例7:
var decoratorWithMultipleAttrs = DirectiveMetadata.create({
selector: 'input[type=text][control]',
id: 'decoratorWithMultipleAttrs',
type: DirectiveMetadata.DIRECTIVE_TYPE
});
var someDirectiveWithProps = DirectiveMetadata.create({
selector: '[some-decor-props]',
properties: ['dirProp: elProp'],
readAttributes: ['some-attr']
});
var someDirectiveWithHostProperties = DirectiveMetadata.create({
selector: '[some-decor-with-host-props]',
host: MapWrapper.createFromStringMap({'[hostProp]': 'dirProp'})
});
var someDirectiveWithInvalidHostProperties = DirectiveMetadata.create({
selector: '[some-decor-with-invalid-host-props]',
host: MapWrapper.createFromStringMap({'[hostProp]': 'dirProp + dirProp2'})
});
var someDirectiveWithHostAttributes = DirectiveMetadata.create({
selector: '[some-decor-with-host-attrs]',
host: MapWrapper.createFromStringMap({'attr_name': 'attr_val', 'class': 'foo bar'})
});
var someDirectiveWithEvents = DirectiveMetadata.create(
{selector: '[some-decor-events]', host: MapWrapper.createFromStringMap({'(click)': 'doIt()'})});
示例8: it
it('should detect additional entries', () => {
expect(MapWrapper.createFromStringMap({'a': 1})).not.toEqual(MapWrapper.createFromStringMap({
'a': 1,
'b': 1
}));
});