import {
Component,
Directive,
Input,
ComponentFactory,
ComponentMetadata,
ComponentResolver,
ReflectiveInjector,
ViewContainerRef
} from '@angular/core';
function createComponentFactory(resolver: ComponentResolver,
metadata: ComponentMetadata): Promise<ComponentFactory<any>> {
const cmp = class DynamicComponent { };
const decoratedCmp = Component(metadata)(cmp);
return resolver.resolveComponent(decoratedCmp);
}
@Directive({
selector: 'html-outlet'
})
export class HtmlOutlet {
@Input() html: string;
constructor(private vcRef: ViewContainerRef, private resolver: ComponentResolver) {}
ngOnChanges() {
if (!this.html) return;
const metadata = new ComponentMetadata({
selector: 'dynamic-html',
template: this.html,
});
createComponentFactory(this.resolver, metadata)
.then(factory => {
const inj = ReflectiveInjector.fromResolvedProviders([], this.vcRef.parentInjector);
this.vcRef.createComponent(factory, 0, inj, []);
});
}
}
<html-outlet [html]="html"></html-outlet>
columnWidth
.columnWidth: ".item"
columnWidth: ".item:not(.item_w2)"
var bar = paper.path(
"M 100, 500" +
"L 200, 450" +
"L 300, 500" +
"L 300, 500" + // эта строка
"Z"
)
iterable<Node>;
Note
In the ECMAScript language binding, an interface that is iterable will have “entries”, “forEach”, “keys”, “values” and @@iterator properties on its interface prototype object.
Хотя на codepen все нормально
display:none
function subcatHeight() {
var $subcategories = $('.subcategories-block'),
$subMenu = $('.goods-menu__subcategories').css({ visibility: 'hidden', display: 'block' });
$subcategories.each(function() {
var $parent = $(this),
item = $parent.find('.subcategories-block__item'),
itemsLength = item.length,
itemsHeight = 0,
itemLonger = 0;
item.each(function() {
itemsHeight += $(this).innerHeight();
if( $(this).innerHeight() > itemLonger )
{
itemLonger = $(this).innerHeight();
}
});
$parent.css({
"max-height" : itemsHeight/4 + itemLonger*0.7
});
});
$subMenu.css({ visibility: '', display: '' });
}
<svg width="260" height="140">
<polyline points="5,135 30,5 55,135 80,5, 105,135 130,5, 155,135 180,5, 205,135 230,5, 255,135"
fill="none" stroke="orangered" stroke-width="5" />
</svg>
<svg width="100" height="30">
<path d="M0,0 l100,0 l-25,30 l-75,0" fill="#018846"/>
</svg>
<svg width="200" height="30">
<path d="M0,0 l100,0 l-25,30 l-75,0 M110,0 l75,0 l0,30 l-100,0" fill="#018846" />
</svg>
<svg width="240" height="80" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 240 80" >
<path d="M0,30 h30 m0,-10 l20,50 h30 m10,0 A40,40 30 1 1 150,70 m10,0 h30 l20,-50 m0,10 h30 M100,30 l10,10 m10,-10 l-10,-10 M130,23 A6,6 0 1 1 100,55" stroke-width="4" stroke="#042138" fill="none"></path>
</svg>
var $block = $('#block');
$block.on('click', function() { console.log('click1'); });
...
// получаем все навешенные ранее обработчики на событие click
var events = $block.data('events').click.slice();
// снимаем обработчики
$block.off('click');
// вешаем новый обработчик поверх предыдущих
$block.on('click', function() { console.log('click2'); });
// заново навешиваем предыдущие
$.each(events, function(i, event) {
$block.on('click', event.handler);
});
declare namespace ymaps {
export function ready(): Promise;
class Promise {
then(onFulfilled?: Function, onRejected?: Function, onProgress?: Function, ctx?: any): Promise;
}
export class Map {
constructor(element: string | any, state: MapState);
}
export class MapState {
center: number[];
controls: string[];
zoom: number;
}
}
/// <reference path="ymaps.d.ts" />
...
ymaps.ready().then(() => {
let myMap = new ymaps.Map("main_map", {
center: [50.450100, 30.523400],
zoom: 12,
controls: ['smallMapDefaultSet']
});
});
declare var ymaps: any;
text
- это DOM элемент и складываете строки, а надо приводить к числамvar conditions = [{
method: 'Len',
params: [e.login, 0],
expected: true,
msg: 'Заполните поле Login'
}, {
method: 'Len',
params: [e.email, 0],
expected: true,
msg: 'Заполните поле Email'
}, {
method: 'Len',
params: [e.pass, 0],
expected: true,
msg: 'Заполните поле Pass'
}, {
method: 'IsLogin',
params: [e.login],
expected: false,
msg: 'Login может содержать a-z . и -'
}, {
method: 'IsEmail',
params: [e.email],
expected: false,
msg: 'Login может содержать a-z . и -'
}];
if(!conditions.some(function(x) {
if(A.Validator[x.method].apply(A.Validator, x.params) === x.expected) {
SetId("error", x.msg);
return false;
}
return true;
})) {
ClearId("error");
e.ok(e.login, e.email, e.pass);
}
{
"draw_white_space": "all",
"word_wrap": "true"
}