#814 fix MDL issues

- additional workarounds for Material Design Lite problems
- validation fixes

fixes #814
This commit is contained in:
Denys Vuika
2016-09-26 15:20:33 +01:00
parent dea16dabe6
commit 433d192b70
10 changed files with 113 additions and 20 deletions

View File

@@ -15,11 +15,10 @@
* limitations under the License.
*/
import { Component } from '@angular/core';
import { Component, ElementRef } from '@angular/core';
import { WidgetComponent } from './../widget.component';
declare let __moduleName: string;
declare var componentHandler;
@Component({
moduleId: __moduleName,
@@ -29,4 +28,25 @@ declare var componentHandler;
})
export class TextWidget extends WidgetComponent {
constructor(private elementRef: ElementRef) {
super();
}
setupMaterialComponents(componentHandler: any): boolean {
// workaround for MDL issues with dynamic components
if (componentHandler) {
componentHandler.upgradeAllRegistered();
if (this.elementRef && this.hasValue()) {
let el = this.elementRef.nativeElement;
let container = el.querySelector('.mdl-textfield');
if (container) {
container.MaterialTextfield.change(this.field.value);
}
}
return true;
}
return false;
}
}