Unable to set custom widgets properties

1
0
-1

I have to create a custom widget in which a property have to be set.
Here is the HTML :

<select ng-model="val" ng-change="ctrl.updateValues()">
    <option ng-repeat="val in availableValues" >{{val}}</option>
</select>

And the controller code :

function filterSelect($scope) {
    $scope.availableValues = $scope.properties.availableValues;

   this.updateValues = function(){
       $scope.properties.value = $scope.val;
       console.log($scope.properties.valueToEmpty);
       $scope.properties.valueToEmpty = "";
       console.log($scope.properties.valueToEmpty);
   };
}

the idea id to empty the "valueToEmpty" property (defined as Bidirectional bond). The updateValues function is called, but the valueToEmpty never changes.
Is there something wrong with my code?

2 answers

1
0
-1

I have the same problem and the bidirectional values did not change.

1
0
-1

Did you try this?

Here is the HTML :
<select ng-model="properties.val" ng-change="ctrl.updateValues()"> <option ng-repeat="val in properties.availableValues" >{{val}}</option> </select>

Here is the controler:

function filterSelect($scope) { 
//$scope.availableValues = $scope.properties.availableValues; 
this.updateValues = function(){ 
//$scope.properties.value = $scope.val; 
//console.log($scope.properties.valueToEmpty); 
$scope.properties.valueToEmpty = ""; 
console.log($scope.properties.valueToEmpty); 
}; 
} 

In some times i used directly the properties and the widget works!

Notifications