Array index out of bounds in Angular 2











up vote
0
down vote

favorite
1












I want to declare an Array with 4 dimensions, then loop some stuff with for() - and then the program breaks. Here is my code:



Typescript:



MoarInfo: any = [[[]]];


JavaScript:



constructor(){
for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){

this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
this.MoarInfo[i][a][b][2] = 'DetailsSpan';

}
}
}
}


The Problem definitively lies at the MoarInfo array. I tested my code without it, and it works fine. I tried the following possibilities for the Typescript array declaration as well:



Moarinfo: any; MoarInfo = ; MoarInfo = [[[]]]; MoarInfo: any = [[[]]];


And in JavaScript, I tried to declare a new Array, and then push some elements on the MoarInfo array, with different functions (split, unshift, push, concat) and nothing worked.



What am I doing wrong?










share|improve this question




























    up vote
    0
    down vote

    favorite
    1












    I want to declare an Array with 4 dimensions, then loop some stuff with for() - and then the program breaks. Here is my code:



    Typescript:



    MoarInfo: any = [[[]]];


    JavaScript:



    constructor(){
    for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
    for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
    for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){

    this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
    this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
    this.MoarInfo[i][a][b][2] = 'DetailsSpan';

    }
    }
    }
    }


    The Problem definitively lies at the MoarInfo array. I tested my code without it, and it works fine. I tried the following possibilities for the Typescript array declaration as well:



    Moarinfo: any; MoarInfo = ; MoarInfo = [[[]]]; MoarInfo: any = [[[]]];


    And in JavaScript, I tried to declare a new Array, and then push some elements on the MoarInfo array, with different functions (split, unshift, push, concat) and nothing worked.



    What am I doing wrong?










    share|improve this question


























      up vote
      0
      down vote

      favorite
      1









      up vote
      0
      down vote

      favorite
      1






      1





      I want to declare an Array with 4 dimensions, then loop some stuff with for() - and then the program breaks. Here is my code:



      Typescript:



      MoarInfo: any = [[[]]];


      JavaScript:



      constructor(){
      for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
      for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
      for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){

      this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
      this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
      this.MoarInfo[i][a][b][2] = 'DetailsSpan';

      }
      }
      }
      }


      The Problem definitively lies at the MoarInfo array. I tested my code without it, and it works fine. I tried the following possibilities for the Typescript array declaration as well:



      Moarinfo: any; MoarInfo = ; MoarInfo = [[[]]]; MoarInfo: any = [[[]]];


      And in JavaScript, I tried to declare a new Array, and then push some elements on the MoarInfo array, with different functions (split, unshift, push, concat) and nothing worked.



      What am I doing wrong?










      share|improve this question















      I want to declare an Array with 4 dimensions, then loop some stuff with for() - and then the program breaks. Here is my code:



      Typescript:



      MoarInfo: any = [[[]]];


      JavaScript:



      constructor(){
      for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
      for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
      for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){

      this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
      this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
      this.MoarInfo[i][a][b][2] = 'DetailsSpan';

      }
      }
      }
      }


      The Problem definitively lies at the MoarInfo array. I tested my code without it, and it works fine. I tried the following possibilities for the Typescript array declaration as well:



      Moarinfo: any; MoarInfo = ; MoarInfo = [[[]]]; MoarInfo: any = [[[]]];


      And in JavaScript, I tried to declare a new Array, and then push some elements on the MoarInfo array, with different functions (split, unshift, push, concat) and nothing worked.



      What am I doing wrong?







      javascript html arrays angular typescript






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 15 at 7:53









      Jesse de Bruijne

      2,46861327




      2,46861327










      asked Nov 15 at 7:00









      Bush_Did_911

      94




      94
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          Check the size of this.MoarInfo[i][a][b]. You are trying to get the value by index 0,1,2. Looks like its size is less than 2 which is causing this error.



                if(this.MoarInfo[i][a][b].size > 0){
          this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
          }
          if(this.MoarInfo[i][a][b].size > 1){
          this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
          }
          if(this.MoarInfo[i][a][b].size > 2){
          this.MoarInfo[i][a][b][2] = 'DetailsSpan';
          }





          share|improve this answer























          • I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
            – Bush_Did_911
            Nov 15 at 7:14










          • Then better would be to have check for index before you access sit. Updated the answer with the same.
            – Sunil Singh
            Nov 15 at 7:17










          • Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
            – Bush_Did_911
            Nov 15 at 7:21


















          up vote
          0
          down vote













          Okay, I figured it out for myself. You have to set the elements of the dimensions from the array at first blank, then you can fill them with content. First I declared an Array in TypeScript like this AnArray = ;. Then I switched to JavaScript ( to the constructer() function ) and filled it with blank elements. I archieved this with this.AnArray.push();. If you want to set elements for the first dimension use push();, if you want an element for the 4th dimension, use push([[]]);. And you can set your content space like this push([[['E1',0,0,'E2']]]);. Now you can use follwing syntax:



          alert( this.AnArray[0][0][0][3] ); //returns 'E2'


          The complete code from my project now works fine and looks like this:



           for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
          this.test.push([[]]);

          for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
          this.test[i].push([]);

          for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){
          this.test[i][a].push(['',0,'']);

          this.test[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
          this.test[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
          this.test[i][a][b][2] = 'DetailsSpan';

          }
          }
          }


          I wonder if there is a better way than using arrays, but if you want it too, you can do it like this.




          • cheers






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314008%2farray-index-out-of-bounds-in-angular-2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote













            Check the size of this.MoarInfo[i][a][b]. You are trying to get the value by index 0,1,2. Looks like its size is less than 2 which is causing this error.



                  if(this.MoarInfo[i][a][b].size > 0){
            this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
            }
            if(this.MoarInfo[i][a][b].size > 1){
            this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
            }
            if(this.MoarInfo[i][a][b].size > 2){
            this.MoarInfo[i][a][b][2] = 'DetailsSpan';
            }





            share|improve this answer























            • I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
              – Bush_Did_911
              Nov 15 at 7:14










            • Then better would be to have check for index before you access sit. Updated the answer with the same.
              – Sunil Singh
              Nov 15 at 7:17










            • Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
              – Bush_Did_911
              Nov 15 at 7:21















            up vote
            1
            down vote













            Check the size of this.MoarInfo[i][a][b]. You are trying to get the value by index 0,1,2. Looks like its size is less than 2 which is causing this error.



                  if(this.MoarInfo[i][a][b].size > 0){
            this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
            }
            if(this.MoarInfo[i][a][b].size > 1){
            this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
            }
            if(this.MoarInfo[i][a][b].size > 2){
            this.MoarInfo[i][a][b][2] = 'DetailsSpan';
            }





            share|improve this answer























            • I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
              – Bush_Did_911
              Nov 15 at 7:14










            • Then better would be to have check for index before you access sit. Updated the answer with the same.
              – Sunil Singh
              Nov 15 at 7:17










            • Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
              – Bush_Did_911
              Nov 15 at 7:21













            up vote
            1
            down vote










            up vote
            1
            down vote









            Check the size of this.MoarInfo[i][a][b]. You are trying to get the value by index 0,1,2. Looks like its size is less than 2 which is causing this error.



                  if(this.MoarInfo[i][a][b].size > 0){
            this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
            }
            if(this.MoarInfo[i][a][b].size > 1){
            this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
            }
            if(this.MoarInfo[i][a][b].size > 2){
            this.MoarInfo[i][a][b][2] = 'DetailsSpan';
            }





            share|improve this answer














            Check the size of this.MoarInfo[i][a][b]. You are trying to get the value by index 0,1,2. Looks like its size is less than 2 which is causing this error.



                  if(this.MoarInfo[i][a][b].size > 0){
            this.MoarInfo[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
            }
            if(this.MoarInfo[i][a][b].size > 1){
            this.MoarInfo[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
            }
            if(this.MoarInfo[i][a][b].size > 2){
            this.MoarInfo[i][a][b][2] = 'DetailsSpan';
            }






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 15 at 7:17

























            answered Nov 15 at 7:06









            Sunil Singh

            6,1122626




            6,1122626












            • I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
              – Bush_Did_911
              Nov 15 at 7:14










            • Then better would be to have check for index before you access sit. Updated the answer with the same.
              – Sunil Singh
              Nov 15 at 7:17










            • Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
              – Bush_Did_911
              Nov 15 at 7:21


















            • I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
              – Bush_Did_911
              Nov 15 at 7:14










            • Then better would be to have check for index before you access sit. Updated the answer with the same.
              – Sunil Singh
              Nov 15 at 7:17










            • Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
              – Bush_Did_911
              Nov 15 at 7:21
















            I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
            – Bush_Did_911
            Nov 15 at 7:14




            I guess with this.MoarInfo[i][a][b].length? In this case its 0. this.MoarInfo[i][a].length is 1 and this.MoarInfo[i].length is 1 aswell. And yeah, you are right!
            – Bush_Did_911
            Nov 15 at 7:14












            Then better would be to have check for index before you access sit. Updated the answer with the same.
            – Sunil Singh
            Nov 15 at 7:17




            Then better would be to have check for index before you access sit. Updated the answer with the same.
            – Sunil Singh
            Nov 15 at 7:17












            Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
            – Bush_Did_911
            Nov 15 at 7:21




            Thank's for you answer man, but this avoids just the error, I would much appreciate it, if the Array would save the values I tell him to ^^
            – Bush_Did_911
            Nov 15 at 7:21












            up vote
            0
            down vote













            Okay, I figured it out for myself. You have to set the elements of the dimensions from the array at first blank, then you can fill them with content. First I declared an Array in TypeScript like this AnArray = ;. Then I switched to JavaScript ( to the constructer() function ) and filled it with blank elements. I archieved this with this.AnArray.push();. If you want to set elements for the first dimension use push();, if you want an element for the 4th dimension, use push([[]]);. And you can set your content space like this push([[['E1',0,0,'E2']]]);. Now you can use follwing syntax:



            alert( this.AnArray[0][0][0][3] ); //returns 'E2'


            The complete code from my project now works fine and looks like this:



             for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
            this.test.push([[]]);

            for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
            this.test[i].push([]);

            for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){
            this.test[i][a].push(['',0,'']);

            this.test[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
            this.test[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
            this.test[i][a][b][2] = 'DetailsSpan';

            }
            }
            }


            I wonder if there is a better way than using arrays, but if you want it too, you can do it like this.




            • cheers






            share|improve this answer

























              up vote
              0
              down vote













              Okay, I figured it out for myself. You have to set the elements of the dimensions from the array at first blank, then you can fill them with content. First I declared an Array in TypeScript like this AnArray = ;. Then I switched to JavaScript ( to the constructer() function ) and filled it with blank elements. I archieved this with this.AnArray.push();. If you want to set elements for the first dimension use push();, if you want an element for the 4th dimension, use push([[]]);. And you can set your content space like this push([[['E1',0,0,'E2']]]);. Now you can use follwing syntax:



              alert( this.AnArray[0][0][0][3] ); //returns 'E2'


              The complete code from my project now works fine and looks like this:



               for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
              this.test.push([[]]);

              for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
              this.test[i].push([]);

              for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){
              this.test[i][a].push(['',0,'']);

              this.test[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
              this.test[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
              this.test[i][a][b][2] = 'DetailsSpan';

              }
              }
              }


              I wonder if there is a better way than using arrays, but if you want it too, you can do it like this.




              • cheers






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                Okay, I figured it out for myself. You have to set the elements of the dimensions from the array at first blank, then you can fill them with content. First I declared an Array in TypeScript like this AnArray = ;. Then I switched to JavaScript ( to the constructer() function ) and filled it with blank elements. I archieved this with this.AnArray.push();. If you want to set elements for the first dimension use push();, if you want an element for the 4th dimension, use push([[]]);. And you can set your content space like this push([[['E1',0,0,'E2']]]);. Now you can use follwing syntax:



                alert( this.AnArray[0][0][0][3] ); //returns 'E2'


                The complete code from my project now works fine and looks like this:



                 for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
                this.test.push([[]]);

                for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
                this.test[i].push([]);

                for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){
                this.test[i][a].push(['',0,'']);

                this.test[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
                this.test[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
                this.test[i][a][b][2] = 'DetailsSpan';

                }
                }
                }


                I wonder if there is a better way than using arrays, but if you want it too, you can do it like this.




                • cheers






                share|improve this answer












                Okay, I figured it out for myself. You have to set the elements of the dimensions from the array at first blank, then you can fill them with content. First I declared an Array in TypeScript like this AnArray = ;. Then I switched to JavaScript ( to the constructer() function ) and filled it with blank elements. I archieved this with this.AnArray.push();. If you want to set elements for the first dimension use push();, if you want an element for the 4th dimension, use push([[]]);. And you can set your content space like this push([[['E1',0,0,'E2']]]);. Now you can use follwing syntax:



                alert( this.AnArray[0][0][0][3] ); //returns 'E2'


                The complete code from my project now works fine and looks like this:



                 for(var i = 0; i < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth].length; i++){
                this.test.push([[]]);

                for(var a = 0; a < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i].length; a++){
                this.test[i].push([]);

                for(var b = 0; b < this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a].length; b++){
                this.test[i][a].push(['',0,'']);

                this.test[i][a][b][0] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][0];
                this.test[i][a][b][1] = this.AllDataInfo[this.KontoAktuellYearIndex][this.KontoAktuellMonth][i][a][b][1];
                this.test[i][a][b][2] = 'DetailsSpan';

                }
                }
                }


                I wonder if there is a better way than using arrays, but if you want it too, you can do it like this.




                • cheers







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 15 at 12:13









                Bush_Did_911

                94




                94






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314008%2farray-index-out-of-bounds-in-angular-2%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    How to change which sound is reproduced for terminal bell?

                    Can I use Tabulator js library in my java Spring + Thymeleaf project?

                    Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents