Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

265
Vistas
In angularjs we are having ng-disabled directive, why ng-enabled directive is not provided by the framework as we are having ng-show and ng-hide

In AngularJs ng-enabled directive is not provided. Is there any proper reason to not providing that directive in the framework, because we are having both ng-show and ng-hide when you can just use ng-hide to achieve our goal.

It wouldn't be nice just to check ng-enabled="attribute.value === true"

instead of ng-disabled="!(attribute.value === true)"

it will increase the readability of the code.

over 4 years ago · Santiago Trujillo
3 Respuestas
Responde la pregunta

0

The reason why there is no ngEnabled directive in Angular is rather semantical - there is simply nothing corresponding to it in HTML specification. At the same time there is already ngDisabled directive that works with disabled attribute. For the same reason, there is no ngUnchecked directive, because there is already ngChecked that sets/removes checked attribute.

Now, the reasonable question: why we have both ngShow and ngHide then? Well it's just for convenience in this case I guess, because having both ngShow and ngHide is not more confusing than ngShow alone, but at the same time it's very handy to have both.

over 4 years ago · Santiago Trujillo Denunciar

0

I am not missing an ng-enabled directive at all and I think it would add little to nothing to the framework.

Inputs are enabled by default and HTML inputs also do not have an enabled attribute, just a disabled. The angular directive sets the HTML disabled attribute, but after evaluating an expression.

You can just write

ng-disabled="!attribute.value"

I think it is pretty readable.

over 4 years ago · Santiago Trujillo Denunciar

0

TLDR: Use angular-enabled instead.

The core team expressed their view in this this comment: https://github.com/angular/angular.js/issues/1252#issuecomment-49261373

They will not abide a feature request just because it has many +1-s in order to keep the core bloat free.

However, if you still want to have ng-enabled functionality, btford has created this handy little module just for you: https://github.com/btford/angular-enabled

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda