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

149
Views
AngularJS and JS array access
var FirstName   = ["Mohammad","Alex","Mustafa","Youssef","Ed"];
var LastName    = ["Boryani","Jones","Safa","Khansa","Snow"];
var Name=[];
var IDInc       = FirstName.length;

for(i=0;i<IDInc;i++)
Name.push(FirstName[i]+" "+LastName[i]);

    let  app = angular.module('NameRecorder', []);
    
    app.controller('GenTable', ['$scope', '$window',

    function($scope, $window) 
    {
        $scope.names = $window.Name;
        console.log($window.IDInc);
    }
                               ]
                  );

Hello all, I have this AngularJS code that used to work in HTML.

After I moved it to a js file and used $window, it doesn't work anymore; console.log doesn't print anything not even the Name array.

I tried some javascript commands in he file to make sure the html main page accesses it and it does

about 4 years ago · Juan Pablo Isaza
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!