I have a controller to add an object and it uses the view. addObject.html
I have another controller that is to edit this object, and when accessing it it fills the whole view addObject.html .
What would be different would be just the submit button that would depend on whether it was "Edit" or "Add"
> I created a variable in the controller called $rootScope.buttonCtrl
.
When accessing addObjetoCtrl
the variable had value $rootScope.buttonCtrl = true;
And when accessing editObjetoCtrl
the variable had value $rootScope.buttonCtrl = false;
And in the view I have
<button type="button" ng-click="addTarefa()" ng-show="buttonCtrl"
class="btn btn-default" ng-disabled="tarefa.titulo == null ||
tarefa.descricao == null || cl.classe==null">
Cadastrar
</button>
<button type="button" ng-click="editarTarefa()" ng-show="buttonCtrl == false"
class="btn btn-default" ng-disabled="tarefa.titulo == null ||
tarefa.descricao==null || cl.classe==null ">
Editar
</button>
But what happens is that view buttonCtrl is always true
, so only the "Register" button " it's showing. What can it be?