Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

128
Views
Cómo agregar $ reloj para la validación de formularios dentro de la clase AngularJS

Intento agregar un reloj $ para verificar si el formulario es válido o no.

// pruebaCtrl.html

 .... <div class="row" ng-form="testCtrl.testForm"> ... <div class="form-group"> <label>NAME</label> <input class="form-control" id="name" type="text" ng-model="testCtrl.testEdit.displayName" autofocus required /> </div> ...

// pruebaCtrl.js

 ... class TestController { constructor($scope, ... ) { ... } ... canSaveTest() { return this.testForm.$valid; } ...

Quiero agregar un observador de esta manera:

 $scope.$watch('testForm.$invalid', function(isInvalid) { $scope.disableNextBtn = isInvalid; });

Pero no estoy seguro en qué parte del código necesito agregar este observador.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Acabo de agregar validateData para ng-change:

// pruebaCtrl.html ...

 <input class="form-control" id="name" type="text" ng-model="testtCtrl.testEdit.displayName" ng-change="testCtrl.validateData()" autofocus required />

// pruebaCtrl.js

 validateData() { this.disableNextBtn = !this.testForm.$valid; }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!