-1

ALguien me puede ayudar...

<input  ng-disabled="true" id="lorem3" type="checkbox" name="lorem" ng-model="layout.layoutActInd">
1
  • <input ng-disabled="true" id="lorem3" type="checkbox" name="lorem" ng-model="layout.layoutActInd">
    – user141463
    el 27 nov. 2019 a las 22:37

3 respuestas 3

4

Prueba a usar este código.

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>

    <script>
    function verificar(){
      var checkbox = document.getElementById('box');
      var text = document.getElementById('txt');

      if(document.getElementById('box').checked) {
        $("#txt").text('Activado');
      } else {
        $("#txt").text('Desactivado');
    }
  }
    </script>
    
    <input type="checkbox" id="box" onclick="verificar()"><label id="txt"></label>

1
  • amm si ya lo checque y si queda el tema es que es con angular y que solo aparezca la palabra activado e inactivado
    – user141463
    el 28 nov. 2019 a las 0:17
1

si entiendo lo que tratas de decir, seria algo asi

<!doctype html>
<html ng-app>
  <head>
    <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js"></script>
  </head>
  <body>
    <div>
      <label>EJEMPLO:</label>

      <input id="lorem3" type="checkbox" name="lorem" ng-model="layout.layoutActInd">
    <b>{{(layout.layoutActInd == true)? 'activo' : 'Inactivo' ;}}</b>
    </div>
  </body>
  <script>
      
  </script>
</html>

0

Si lo que quieres es cambiar los valores al tener el check activo o no podrías hacer lo siguiente:

<input type="checkbox" ng-model="tucheckbox" name="tucheckbox" id="tucheckbox" ng-init="tucheckbox = 'activo'" ng-true-value="'activo'" ng-false-value="'inactivo'"> {{ tucheckbox == 1 ? 'Activo' : 'Inactivo' }}

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.