Angular Validation

#1

Sorry for my poor english, in this sample below i can see json properties, but i can´t acess this same properties when validation error.

see in --> . <pre>error = {{ exampleForm.toKen.$error | json }}</pre>

=====================================================================================

Gerenciador Padrao
{{msg.payload.display}}
    {{msg.payload.menu}}
Token
          <div ng-messages="exampleForm.toKen.$error" role="alert">
            <div ng-message="required">Informe o Token.</div>
            <div ng-message="pattern">Não aparenta formato de Token </div>
            <div ng-message="maxlength"> Não mais de 6 digitos </div>
            <div ng-message="minlength"> Pelo menos 6 digitos </div>
          </div>
          
        </md-input-container>
         <pre>error = {{ exampleForm.toKen.$error | json }}</pre>
    </div> 

    <div class="botoes"> 
        <center> 
            <button type="submit" class="botao_azul"     ng-disabled="habbotok()"   ng-hide="habbotok()"   ng-click="send({payload:'okbotao'});" >Ok</button>
            <button type="submit" class="botao_azul"   ng-disabled="habbotconf()" ng-hide="habbotconf()" ng-click="send({payload:'confirmabotao'});" >Confirma</button>
            <button type="submit" class="botao_verm" ng-disabled="habbotcanc()" ng-hide="habbotcanc()" ng-click="send({payload:'cancelabotao'});" >Cancela</button>
        </center>            
    </div> 
    <div class="botoes"> 
        <center> 
            <md-button class="md_azul"  ng-disabled="habcoletatoken()" ng-hide="habcoletatoken()" ng-click="scope.isDisable || send({payload:action()})">       <md-icon md-svg-src='/img/done-01_24.svg'   style="color: blue; width: 5%; height: 5%"></md-icon> Confirma </md-button>            
            <md-button class="md_verm"  ng-disabled="habcoletatoken()" ng-hide="habcoletatoken()" ng-click="send({payload:'cancelabotao'})"> <md-icon md-svg-src='/img/remove-01_24.svg' style="color: red;  width: 5%; height: 5%"></md-icon> Cancela </md-button>            
            <!--button type="submit" class="botao"   ng-disabled="habcoletatoken()" ng-hide="habcoletatoken()" ng-click="send({payload:action()});" >Confirma</button>
            <button type="submit" class="botao" ng-disabled="habcoletatoken()" ng-hide="habcoletatoken()" ng-click="send({payload:'cancelabotao'});" >Cancela</button-->            
        </center>            
    </div>             

    <script>
        (function(scope) {
            scope.error = {};
            scope.isDisable=true;
            scope.firstName= "";
            scope.lastName= "";
            scope.dados= "";
            scope.lista=false;
            scope.coleta={token:false,cpf:false,cnpj:false,fone:false,numero:false};
            scope.botao={ok:false,conf:false,cancel:false}
            console.log('Position 1');
            console.dir(scope);
            scope.$watch('msg.payload', function(data) {
                console.log('Position 2');
                console.dir(data);
                if (typeof data.botao !== "undefined") {
                    //console.dir(data.botao)
                    if (typeof data.botao.ok === "undefined") {                           
                       scope.botao.ok = false
                       //console.log("botao.ok undefined:%s",scope.botao.ok)
                    } else {
                       scope.botao.ok = (data.botao.ok !== 0)
                       //console.log("botao.ok defined:%s <- %s",scope.botao.ok,data.botao.ok)
                    }
                    if (typeof data.botao.conf === "undefined") {
                       scope.botao.conf = false
                       //console.log("botao.conf undefined:%s",scope.botao.conf)
                    } else {
                       scope.botao.conf = (data.botao.conf !== 0)
                       //console.log("botao.conf defined:%s <- %s",scope.botao.conf,data.botao.conf)
                    }
                    if (typeof data.botao.cancel === "undefined") {
                       scope.botao.cancel = false
                       //console.log("botao.cancel undefined:%s",scope.botao.cancel)
                    } else {
                       scope.botao.cancel = (data.botao.cancel !== 0)
                       //console.log("botao.cancel defined:%s <- %s",scope.botao.cancel,data.botao.cancel)
                    }
                }
                if (typeof data.coleta !== "undefined") {
                    console.dir(data.coleta)
                    if (typeof data.coleta.token === "undefined") {
                       scope.coleta.token = false
                       console.log("coleta.token undefined:%s",scope.coleta.token)
                    } else {
                       scope.coleta.token = (data.coleta.token !== 0)
                       console.log("coleta.token defined:%s <- %s",scope.coleta.token,data.coleta.token)
                    }
                    if (scope.coleta.token) {

                    }

                }

                
            });
            this.scope.action = function() { 
                var resp = { dados : scope.dados }
                if (scope.coleta.token == 1) {
                   resp.token = 1
                }
                if (scope.coleta.cpf == 1) {
                   resp.cpf = 1
                }
                if (scope.coleta.cnpj == 1) {
                   resp.cnpj = 1
                }
                if (scope.coleta.fone == 1) {
                   resp.fone = 1
                }
                if (scope.coleta.numero == 1) {
                   resp.numero = 1
                }
                return resp; // { dados : scope.dados  }
            } 
           // this.scope.habdisp = function () { return (msg.payload.display.lenght === 0) };
            this.scope.habbotok = function () { 
                   //console.log("botao.ok:%s",!scope.botao.ok )
                   return !scope.botao.ok 
            };
            this.scope.habbotconf = function () {
                   //console.log("botao.conf:%s",!scope.botao.conf )
                   return (!scope.botao.conf) 
            };
            this.scope.habbotcanc = function () {
                  //console.log("botao.cancel:%s",!scope.botao.cancel )                
                  return !scope.botao.cancel 
            };
            this.scope.hablista = function () { return !scope.lista };
            this.scope.habcoleta = function () { 
                    console.log("coleta.token1:%s" ,!scope.coleta.token ) 
                    //console.log("coleta.cpf:%s"   ,!scope.coleta.cpf )
                    //console.log("coleta.cnpj:%s"  ,!scope.coleta.cnpj )
                    //console.log("coleta.fone:%s"  ,!scope.coleta.fone )
                    //console.log("coleta.numero:%s",!scope.coleta.numero )
                    return (!scope.coleta.token) || (!scope.coleta.cpf) || (!scope.coleta.cnpj) || (!scope.coleta.fone) || (!scope.coleta.numero)  
            };
            this.scope.habcoletatoken = function () {
                    console.log("coleta.token2:%s",!scope.coleta.token )

                    if(scope.coleta.token){                        
                        console.log("exampleForm.toKen.$error:")   
                        console.dir( exampleForm ); 
                    }                    
                   
                    return (!scope.coleta.token)
            };
        })(scope);
    </script>       
    
</div>