本文整理汇总了TypeScript中angular2/src/dom/dom_adapter.DOM.addClass方法的典型用法代码示例。如果您正苦于以下问题:TypeScript DOM.addClass方法的具体用法?TypeScript DOM.addClass怎么用?TypeScript DOM.addClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类angular2/src/dom/dom_adapter.DOM
的用法示例。
在下文中一共展示了DOM.addClass方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
setterFn = function(element, value) {
if (value) {
DOM.addClass(element, dashCasedClassName);
} else {
DOM.removeClass(element, dashCasedClassName);
}
};
示例2: _toggleClass
_toggleClass(className, enabled) {
if (enabled) {
DOM.addClass(this._domEl, className);
} else {
DOM.removeClass(this._domEl, className);
}
}
示例3: expect
tb.createView(TestComponent, {html: html}).then((view) => {
view.detectChanges();
DOM.addClass(view.nodes[0].childNodes[1], "foo");
view.context.numberCondition = 2;
view.detectChanges();
expect(DOM.hasClass(view.nodes[0].childNodes[1], "foo")).toBe(true);
async.done();
});
示例4: expect
.then((view) => {
view.detectChanges();
DOM.addClass(view.rootNodes[0].childNodes[1], "foo");
view.context.numberCondition = 2;
view.detectChanges();
expect(DOM.hasClass(view.rootNodes[0].childNodes[1], "foo")).toBe(true);
async.done();
});
示例5: expect
.then((rootTC) => {
rootTC.detectChanges();
DOM.addClass(DOM.querySelector(rootTC.nativeElement, 'copy-me'), "foo");
rootTC.componentInstance.numberCondition = 2;
rootTC.detectChanges();
expect(DOM.hasClass(DOM.querySelector(rootTC.nativeElement, 'copy-me'), "foo"))
.toBe(true);
async.done();
});
示例6: createRootProtoView
static createRootProtoView(protoView, insertionElement, rootComponentBinding, protoChangeDetector, shadowDomStrategy) {
DOM.addClass(insertionElement, NG_BINDING_CLASS);
var cmpType = rootComponentBinding.key.token;
var rootProtoView = new ProtoView(insertionElement, protoChangeDetector, shadowDomStrategy);
rootProtoView.instantiateInPlace = true;
var binder = rootProtoView.bindElement(null, 0, new ProtoElementInjector(null, 0, [cmpType], true));
binder.componentDirective = rootComponentBinding;
binder.nestedProtoView = protoView;
shadowDomStrategy.shimAppElement(cmpType, insertionElement);
return rootProtoView;
}
示例7:
(className) => { DOM.addClass(compileElement.element, className); });
示例8: constructor
constructor(el: ElementRef) { DOM.addClass(el.domElement, 'compiled'); }
示例9: bindElement
bindElement(element, description = null) {
var builder = new ElementBinderBuilder(this.elements.length, element, description);
ListWrapper.push(this.elements, builder);
DOM.addClass(element, NG_BINDING_CLASS);
return builder;
}