mercredi 27 décembre 2017

Property 'checked' does not exist on type 'HTMLElement' angular 4

i am trying to checkbox check value get from .ts file. take a Boolean variable and purpose to show and hide div using this variable but faced a problem this help to solve this and also give me the right way to do this.here is my code...

.html code

checkbox codeabcde" class="form-check-input" id="abcde" value="1"(change)="checked('abcde')"> abcde

show and hide code

*ngIf='shown'

.ts file

checked(value) {

    let get_id = document.getElementById('abcde');

    if (get_id.checked == true) {
        this.shown = true
    }
    else if (get_id.checked == false)
        this.shown = false;
}

when i run ng serve then show "Property 'checked' does not exist on type 'HTMLElement'"

advance thanks




Aucun commentaire:

Enregistrer un commentaire