Angular - How to bind Checkbox with Array

Поделиться
HTML-код
  • Опубликовано: 25 окт 2024

Комментарии • 22

  • @MrFsudude
    @MrFsudude 3 года назад +3

    Your video helped me to realise there is an easier way to do this - just use two way data binding on the boolean value, e.g. ''. No method needed, clicking the checkbox immediately changes the value of the 'selected' attribute

  • @555garlic
    @555garlic Год назад

    usually youtube coding doesn't work, but this worked perfectly. thnx

  • @nitinpatil6441
    @nitinpatil6441 6 месяцев назад

    Thank you this video helped me a lot..

  • @thowheedh
    @thowheedh 3 года назад

    Really Nice it helped in my project

  • @Martin56754
    @Martin56754 Год назад

    Excelent friend

  • @manthoshn4386
    @manthoshn4386 2 года назад +2

    i dont know if you are gonna read my comment , but this video definetly helped me a lot, thank you

  • @joshuajames7231
    @joshuajames7231 Год назад

    how would you create a method that allows you to select all of the checkboxes?

  • @MiguelCastro-qu4nf
    @MiguelCastro-qu4nf Год назад

    Very nice!

  • @raghavendra9297
    @raghavendra9297 Месяц назад

    If i select all manually then this will fail, How to solve this?

  • @rockingalam7125
    @rockingalam7125 Год назад

    Sir this.parentSelector=false ; की जगह आप this.patentSelector=isChecked ;भी कर सकते है क्या??

  • @531Rupalli
    @531Rupalli 3 года назад

    How to use check boxes as formarray's form control and how to set value of check boxes boxes based on presence of data in db

    • @Mustafa-Muharrem
      @Mustafa-Muharrem 2 года назад

      i've been struggling with this for two days, do you have a solution

  • @MarkWisniewski-rn4in
    @MarkWisniewski-rn4in Год назад

    This is great and very helpful. How would this be done if the array was held as a Behavior subject? eg. food = new BehaviorSubject([{ id: 1, select: false, name:'dumpling'}, { id: 2, select: false, name:'hamburger'}, { id: 1, select: false, name:'sandwich'} ]);

  • @lonelyboy4746
    @lonelyboy4746 3 года назад

    But when you select item 1 2 and 3, Dose the parent checkbox is checked automatically?

    • @Samlama8848
      @Samlama8848  3 года назад

      Not yet, but you can make one.

    • @mamtaverma2501
      @mamtaverma2501 2 года назад

      @@Samlama8848 How we can make that code?

  • @LeandroTercette
    @LeandroTercette 3 года назад

    Hi man
    I'm trying to do the same thing but using a array enclosed on .model.ts . This code is not working "map operator is complaining" any hint?
    Thanks

    • @Samlama8848
      @Samlama8848  3 года назад

      Make sure variable you used is Array.

  • @jurgenruegenberg2214
    @jurgenruegenberg2214 3 года назад

    Hello my [checked] is not recognizing it why do you think is this?

    • @Samlama8848
      @Samlama8848  3 года назад

      Make sure you add Form Module, if that not working then I recommend to download/clone GIT and try to run. Thanks

  • @TrollMeister_
    @TrollMeister_ Год назад

    This did not help at all. What do you set ngModel to ? How can you pass checkbox values directly to an array in the model without having to do event handling ?