Bonjour je souhaiterai selectionner dans mes parametres uniquement celle qui sont visible (hidden=true) sur ma page web ...

$scope.params = {"material": { "value": ["MAT1"], "activatedBy": [], "desactivatedBy": [], "hidden": false, "fixed": false}, "Analysis": { "value": ["MECA"], "activatedBy": [], "desactivatedBy": [], "hidden": false, "fixed": true}, "Temperature": {"value": "100", "activatedBy": [], "desactivatedBy": [], "hidden": true, "unit": "C"}, "Position in y": {"value": "12", "activatedBy": [], "desactivatedBy": [], "hidden": true, "linked": {"relation": {"a": 1, "b": 0}, "value": ""}, "unit": "mm"}, "Position in x": {"value": "12", "activatedBy": [], "desactivatedBy": [], "hidden": true, "linked": {"relation": {"a": 1, "b": 0}, "value": ""}, "unit": "mm"}, CTE": {"value": "30", "activatedBy": [], "desactivatedBy": [], "hidden": true, "linked": {"relation": {"a": 1, "b": 0}, "value": ""}, "unit": "PPM/K"}};
    var params = "{";
    for(var key in $scope.params){
        params += "'" + key + "':";
    }
    params = params.slice(0, -1) + "}";

Ce code fonctionne et me met tous les keys dans params Et pour filtrer j'ai teste :

    var params = "{";
    for(var key in $scope.params){
        if($scope.params[key].hidden == "true"){
            params += "'" + key + "':";
        }
    }
    params = params.slice(0, -1) + "}";        

qui ne fonctionne pas
Merci d'avance

Aucune réponse