0

I use angular-strap library to add datepicker element. The input element is in a row, and when I click row, I change it's color. Now when I click on div with class datepicker, or other child table row the event is trigger. I need to prevent it. How can I do?

    <table class='css_table'>
        <thead class='css_thead'>
            <tr class='css_tr'>
                <th class='css_th'>Data</th>
            </tr>
        </thead>

        <tbody class='css_tbody' ng-repeat='home in village'>
            <tr ng-click='select(home)' ng-class="{'selected':home.isSelected}" >

                <td class='css_td'>
                    <input type="text" ng-model="selectedDate" name="date" ng-click='$event.stopPropagation()' bs-datepicker>
                </td>
            </tr>
    </tbody>
</table>



$scope.select = function(home){
    
    if(home.isSelected == undefined){
        home.isSelected = true;
    }else{
        home.isSelected = !home.isSelected;
    }
}

1 Answer 1

0

This piece of code should work.

<div ng-click="parentHandler()">
    <div ng-click="childHandler(); $event.stopPropagation()"></div>
</div>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.