Angular Google Maps (AGM) using multiple attributes












0















I'm trying to use the @agm/core to implement google maps API in my Angular app. I've tried using this documentation https://angular-maps.com/api-docs/agm-core/directives/agmcircle and following this example (among others): https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html.



Along those examples and documentation I created this sample of code:



  <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
<agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
</agm-map>


Which works great. BUT, when I try to implement agm-circle:



  <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
<agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
<agm-circle [latitude]="+room.latitude" [longitude]="+room.longitude"
[radius]="5000"
[fillColor]="'red'"
[circleDraggable]="true"
[editable]="true">
</agm-circle>
</agm-map>


I keep receiving errors. The error I get is:



ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forEach' of null
TypeError: Cannot read property 'forEach' of null
at AgmCircle.push../node_modules/@agm/core/directives/circle.js.AgmCircle.ngOnDestroy (circle.js:169)


I can't figure out if I'm using an old version of AGM or what. Is this API deprecated?



EDIT::



So this is weird, if I add +.3 or however any amount then agm-circle works without any problems.



  <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
<agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
<agm-circle [latitude]="+room.latitude +0.3" [longitude]="+room.longitude"
[radius]="5000"
[fillColor]="'red'"
[circleDraggable]="true"
[editable]="true">
</agm-circle>
</agm-map>


Would anyone know the reason why? The forEach error seems totally irrelevant to what I did to not have the problem occur anymore.



EDIT::



Now that I'm able to recreate the problem causing this error: I figured out it has something to do with the observable "room".










share|improve this question





























    0















    I'm trying to use the @agm/core to implement google maps API in my Angular app. I've tried using this documentation https://angular-maps.com/api-docs/agm-core/directives/agmcircle and following this example (among others): https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html.



    Along those examples and documentation I created this sample of code:



      <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
    <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
    </agm-map>


    Which works great. BUT, when I try to implement agm-circle:



      <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
    <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
    <agm-circle [latitude]="+room.latitude" [longitude]="+room.longitude"
    [radius]="5000"
    [fillColor]="'red'"
    [circleDraggable]="true"
    [editable]="true">
    </agm-circle>
    </agm-map>


    I keep receiving errors. The error I get is:



    ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forEach' of null
    TypeError: Cannot read property 'forEach' of null
    at AgmCircle.push../node_modules/@agm/core/directives/circle.js.AgmCircle.ngOnDestroy (circle.js:169)


    I can't figure out if I'm using an old version of AGM or what. Is this API deprecated?



    EDIT::



    So this is weird, if I add +.3 or however any amount then agm-circle works without any problems.



      <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
    <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
    <agm-circle [latitude]="+room.latitude +0.3" [longitude]="+room.longitude"
    [radius]="5000"
    [fillColor]="'red'"
    [circleDraggable]="true"
    [editable]="true">
    </agm-circle>
    </agm-map>


    Would anyone know the reason why? The forEach error seems totally irrelevant to what I did to not have the problem occur anymore.



    EDIT::



    Now that I'm able to recreate the problem causing this error: I figured out it has something to do with the observable "room".










    share|improve this question



























      0












      0








      0








      I'm trying to use the @agm/core to implement google maps API in my Angular app. I've tried using this documentation https://angular-maps.com/api-docs/agm-core/directives/agmcircle and following this example (among others): https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html.



      Along those examples and documentation I created this sample of code:



        <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
      <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
      </agm-map>


      Which works great. BUT, when I try to implement agm-circle:



        <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
      <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
      <agm-circle [latitude]="+room.latitude" [longitude]="+room.longitude"
      [radius]="5000"
      [fillColor]="'red'"
      [circleDraggable]="true"
      [editable]="true">
      </agm-circle>
      </agm-map>


      I keep receiving errors. The error I get is:



      ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forEach' of null
      TypeError: Cannot read property 'forEach' of null
      at AgmCircle.push../node_modules/@agm/core/directives/circle.js.AgmCircle.ngOnDestroy (circle.js:169)


      I can't figure out if I'm using an old version of AGM or what. Is this API deprecated?



      EDIT::



      So this is weird, if I add +.3 or however any amount then agm-circle works without any problems.



        <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
      <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
      <agm-circle [latitude]="+room.latitude +0.3" [longitude]="+room.longitude"
      [radius]="5000"
      [fillColor]="'red'"
      [circleDraggable]="true"
      [editable]="true">
      </agm-circle>
      </agm-map>


      Would anyone know the reason why? The forEach error seems totally irrelevant to what I did to not have the problem occur anymore.



      EDIT::



      Now that I'm able to recreate the problem causing this error: I figured out it has something to do with the observable "room".










      share|improve this question
















      I'm trying to use the @agm/core to implement google maps API in my Angular app. I've tried using this documentation https://angular-maps.com/api-docs/agm-core/directives/agmcircle and following this example (among others): https://stackblitz.com/edit/angular-google-maps-demo?file=app%2Fapp.component.html.



      Along those examples and documentation I created this sample of code:



        <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
      <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
      </agm-map>


      Which works great. BUT, when I try to implement agm-circle:



        <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
      <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
      <agm-circle [latitude]="+room.latitude" [longitude]="+room.longitude"
      [radius]="5000"
      [fillColor]="'red'"
      [circleDraggable]="true"
      [editable]="true">
      </agm-circle>
      </agm-map>


      I keep receiving errors. The error I get is:



      ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'forEach' of null
      TypeError: Cannot read property 'forEach' of null
      at AgmCircle.push../node_modules/@agm/core/directives/circle.js.AgmCircle.ngOnDestroy (circle.js:169)


      I can't figure out if I'm using an old version of AGM or what. Is this API deprecated?



      EDIT::



      So this is weird, if I add +.3 or however any amount then agm-circle works without any problems.



        <agm-map [latitude]="+room.latitude" [longitude]="+room.longitude">
      <agm-marker [latitude]="+room.latitude" [longitude]="+room.longitude"></agm-marker>
      <agm-circle [latitude]="+room.latitude +0.3" [longitude]="+room.longitude"
      [radius]="5000"
      [fillColor]="'red'"
      [circleDraggable]="true"
      [editable]="true">
      </agm-circle>
      </agm-map>


      Would anyone know the reason why? The forEach error seems totally irrelevant to what I did to not have the problem occur anymore.



      EDIT::



      Now that I'm able to recreate the problem causing this error: I figured out it has something to do with the observable "room".







      angular angular-google-maps






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 31 '18 at 17:17







      Nov

















      asked Dec 31 '18 at 16:57









      NovNov

      266




      266
























          0






          active

          oldest

          votes











          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',
          autoActivateHeartbeat: false,
          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%2f53989715%2fangular-google-maps-agm-using-multiple-attributes%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53989715%2fangular-google-maps-agm-using-multiple-attributes%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

          Monofisismo

          Angular Downloading a file using contenturl with Basic Authentication

          Olmecas