I have three tabs with content. All interaction with the fields is controlled by AngularJS.
I need to clear the fields after changing the tab (when clicking).
How can I do this?
HtmlCode
<!DOCTYPEhtml><html><head><title>CriandoAbas</title><metacharset="UTF-8" />
<style type="text/css">
.abas {
position: relative;
}
.aba {
display: inline;
}
.aba > a {
float: left;
padding: 0.5em 1em;
background: linear-gradient(#FFF, #EEE);
border-width: 1px;
border-style: solid;
border-color: #CCC #CCC #FFF;
border-top-right-radius: 8px;
border-top-left-radius: 8px;
}
.aba:not(:target) a {
border-bottom: 0 none;
}
.aba:target a, a:hover {
background: white;
}
.conteudo {
position: absolute;
left: 0;
top: calc(2em + 4px); /* altura do link + bordas */
z-index: -2;
border: 1px solid #CCC;
background-color: white;
}
.aba:target .conteudo {
z-index: -1;
}
</style>
</head>
<body>
<!-- Criando a listagem -->
<ul class="abas">
<!-- Aqui, criação da primeira aba -->
<li class="aba" id="aba-1">
<a href="#aba-1">Aba1</a>
<section class="conteudo"> Conteúdo da Aba 1 </section></li>
<!-- Aqui, criação da segunda aba -->
<li class="aba" id="aba-2">
<a href="#aba-2">Aba 2</a>
<section class="conteudo"> Conteúdo da Aba 2 </section></li>
<!-- Aqui, criação da terceira aba -->
<li class="aba" id="aba-3">
<a href="#aba-3">Aba 3</a>
<section class="conteudo"> Conteúdo da Aba 3 </section></li>
</ul>
</body>
</html>
JavaScript code
angular.module('xxxx').controller('xxxController', function ($scope) {
var m = $scope;
m.validarAba1 = function(){
$scope.message = "TESTE1";
};
m.validarAba2 = function(){
$scope.message = "TESTE2";
};
m.validarAba3 = function(){
$scope.message = "TESTE3";
};
}