0
I am trying to do a cleaning in a form, used $setPristine() from the Angularjs...
When trying to clean up a fluffy with:
$scope.reset = function(){
$scope.form.$setPristine();
$scope.perfilDeAcesso = '';
};
works normally but I’m trying to create a directive, and for it to still work I need a code similar to this:
$scope.limpar = function(modelForm,modelObjeto){
console.log(modelForm);
console.log(modelObjeto);
modelObjeto = {};
modelForm.$setPristine();
};
my exit in the console by double clicking on the button that calls Function
c {$error: Object, $name: "formPerfilDeAcesso", $dirty: true, $pristine: false, $valid: true…}
perfilDeAcessoCtrl.js:73
Object {itensPerfilDeAcesso: Array[3], nome: "ssssssssssssss"}
perfilDeAcessoCtrl.js:74
c {$error: Object, $name: "formPerfilDeAcesso", $dirty: false, $pristine: true, $valid: true…}
perfilDeAcessoCtrl.js:73
Object {itensPerfilDeAcesso: Array[3], nome: "ssssssssssssss"}
in this code section you can notice that the $setPristine() methdo worked because the $pristine attribute was changed, but the object was not set to vázio....
Can anyone tell me why?
I found out what it was... when I pass an object that is in my scope as parameter to another Cope or the same Cope has no way to modify the object, in case I decided implying a directive.
– Luiz Fernando Dubiela