1
Ich benutze AngularJS Typoskript-Anwendung. Ich versuche Farbe von Colorpicker zu holen ab jetzt ist mir den Wert von Farbwähler bekommen, aber ich bin nicht in der Lage, die Farbe als Hintergrund für meine div.My ts-Datei zu binden, wird alsIch bin nicht in der Lage, meinen ausgewählten Wert von Colorpicker zu binden
class UserDefinedElementTypeController {
public mycolor: string = "#f0f0f0";
constructor(private $scope: ng.IScope) {
this.watchForcolorChanges();
}
private watchForcolorChanges() {
this.mycolor = "#0f0f0f";
this.$scope.$watch(() => this.mycolor, function (newVal, oldval) {
console.log(oldval, newVal);
this.divStyle = {
'background-color': newVal
}
});
}
}
mainAngularModule.controller("userdefinedelementtype", UserDefinedElementTypeController);
HTML-Code folgt
<input type="color" ng-model="UDETController.mycolor" />
<div ng-style="UDETController.divStyle">Testing for background color </div>
Fehle ich etwas?