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

210
Views
How to clear an angularJS array
 $scope.itemarray = ['A', 'B', 'C'];  

this will clear the array but the ui wont be updated.

$scope.itemarray = [];

this works fine! why?

 $scope.itemarray.length = 0;  
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

$scope.itemarray.length = 0; << this is correct. Length is read-write property.

$scope.itemarray = []; << this creates new empty array. If you have bindings to old itemarray, they may be lost. (Html binding like ng-if="itemarray[0]" wont be lost)

over 4 years ago · Santiago Trujillo 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!