JavaScript parsing CSV in Javascript and AngularJS javascript parser angularjs,defer parsing of javascript angularjs

Many problems in your code :

  • You could juste use split on your input instead of regexes, it makes everything easier
  • Your HTML isn't valid td should be inside tr and not the other way around
  • Your array was never cleared
  • Your bindings inside ng-repeat didn't use variable i defined here : i in inviteList
  • You should avoid unscoped variables (without var keyword) whenever possible

Otherwise, when you split a string, just access the splitted elements through their index.

Corrected code :

JS

$scope.$watch("excelData", function() {
    var lines, lineNumber, data, length;
    $scope.inviteList = [];
    lines = $scope.excelData.split('\n');
    lineNumber = 0;
    for (var i = lines.length - 1; i >= 0; i--) {
        l = lines[i];

        lineNumber++;
        data = l.split(',');

        var name = data[0];
        var email = data[1];

        $scope.inviteList.push({
            name: name,
            email: email,
            status: "not sent"
        });
    }
});

HTML

  <table>
    <tr>
      <th>Name</th>
      <th>Email</th>
      <th>Status</th>
    </tr>
    <tr ng-repeat="i in inviteList">
      <td>{{i.name}}</td>
      <td>{{i.email}}</td>
      <td>{{i.status}}</td>
    </tr>
  </table>

Your code (especially JS) can still be improved a lot and i encourage you to read docs/tutorials more.

And here is the plunker to your working code.

Answer:1

Requirement : Trigger a jsp page refresh when some value in the server changes. Ajax is an option, but refreshing the JSP at a particular interval will increase the load on the server. Since i am ...

Requirement : Trigger a jsp page refresh when some value in the server changes. Ajax is an option, but refreshing the JSP at a particular interval will increase the load on the server. Since i am ...

  1. trigger page refresh javascript
  2. trigger page refresh react
  3. trigger page refresh angular
  4. trigger page refresh jquery
  5. trigger page refresh
  6. trigger page refresh c#
  7. trigger page refresh asp.net
  8. trigger page refresh java
  9. js trigger page refresh
  10. php trigger page refresh
  11. ajax trigger page refresh
  12. vue trigger page refresh
  13. html trigger page refresh
  14. jsf trigger page refresh
  15. browser trigger page refresh
  16. salesforce trigger refresh page
  17. angular 6 trigger page refresh
  18. onbeforeunload trigger on page refresh

I'm building a JQM app. It's a multiple page app that uses the jquery mobile page divs to hide and show pages as it goes through. The pages are laid out like: <div data-role="page" id="listpets" ...

I'm building a JQM app. It's a multiple page app that uses the jquery mobile page divs to hide and show pages as it goes through. The pages are laid out like: <div data-role="page" id="listpets" ...

  1. pagecontainer show
  2. jquery mobile pagecontainer show

I am building an UI with jsPlumb were I have multiple boxes that can be connected together. Each box has 1 target and 3 sources, made with the makeTarget and makeSource methods called upon the same ...

I am building an UI with jsPlumb were I have multiple boxes that can be connected together. Each box has 1 target and 3 sources, made with the makeTarget and makeSource methods called upon the same ...

I need to define different style by the value of a champ in ng-repeat, i try this : <thead> <tr><th>#</th><th>Nom</th><th>Ville</th><th style="...

I need to define different style by the value of a champ in ng-repeat, i try this : <thead> <tr><th>#</th><th>Nom</th><th>Ville</th><th style="...

  1. angularjs repeat index
  2. angularjs repeat filter
  3. angularjs repeat n times
  4. angularjs repeat orderby
  5. angularjs repeat object
  6. angularjs repeat track by
  7. angularjs repeat without element
  8. angularjs repeat limit
  9. angularjs repeat sort
  10. angularjs repeat key value
  11. angularjs repeat array
  12. angularjs repeat group by
  13. angularjs repeat filter function
  14. angularjs repeat table
  15. angularjs repeat x times
  16. angularjs repeat div
  17. angularjs repeat last
  18. angularjs repeat select option
  19. angularjs repeat element n times
  20. angularjs repeat if