A
A
asdevlog2020-03-08 17:40:09
C++ / C#
asdevlog, 2020-03-08 17:40:09

Balloon Ymaps in Angular. How to properly subscribe to events in BaloonContent?

Hello.
There is a project with the display of labels on the Yandex map.
Each label has a balloon and it has three buttons in the BaloonContent section.

I used the Ymaps package to connect.
here is an example content:

balloonContentFooter: [
                  '<button id="assign-btn" onclick="onClickAssign()">',
                  '<i class="material-icons"> time_to_leave</i></button>',
                  '<button mat-flat-button style="margin-left: 10px"> <i class="material-icons"> beenhere</i></button>',
                  '<button mat-flat-button style="margin-left: 10px" color="primary"> <i class="material-icons"> format_color_reset</i></button>'

                ].join('')


It's clear that the angular directives in this case do not work out =( and I somehow need to subscribe to the events of these buttons. I found an example in the manual, but I could not figure out how to correctly translate it into ts. https://tech.yandex.ru/maps/ jsbox/2.1/placemark_ba...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Roman, 2019-07-28
@Wirsak

Often the debugger points to the next line (instruction) after the problematic one, as in this case.
In order for everything to work for you, x and y must be equal to the number 0, 1 or 2. And Console.Read reads a character, not a number. Those. by entering 0, you get the character '0', which corresponds to the number 48.
You need to process the input, cut off the wrong characters and convert the characters to numbers.

Y
Yuri Esin, 2019-07-28
@Exomode

const int FieldWidth = 3;
    const int FieldHeight = 3;

    int[,] array = new int[FieldWidth, FieldHeight];

    //Ввод нуля и последующая проверка на выигрыш.
    public void Enter0()
    {
      int x, y;

      while (!int.TryParse(Console.Read(), out x) || x < 0 || x >= FieldWidth) continue; // Здесь можно обработать неверный ввод.
      while (!int.TryParse(Console.Read(), out y) || y < 0 || y >= FieldHeight) continue; // Здесь можно обработать неверный ввод.

      array[x, y] = 0;
      draw_array();
      if (Check(x, y))
        Player.Win();
    }

And everywhere in the code, replace the triples with constants.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question