angularjs - How can I change ng-click behavior for a single element in an ng-repeat? -


I am restructuring a table written in angular. NG-Repetition is currently used to create rows of several tables, none of which is redirected to a given UI-sref when clicked:

  & Lt; Tbody & gt; & Lt; Tr ng-repeat = "user in group | order by: sorter: reverse" class = "tablebox-content" ui-sref = "admin.candidates.detail ({_ id: user._id})" & gt; & Lt; Td class = "name" & gt; {{User.name}} & lt; / Td> & Lt; Td> {{User.attending? 'Yes': 'no'}} & lt; / Td> & Lt; Td square = "interest declined" & gt; {{User.interestDeclared}} & lt; / Td> & Lt; Td class = "interestThreeOrGreater" & gt; {{User.interestThreeOrGreater}} & lt; / Td> & Lt; Td class = "GitHub" & gt; & Lt; A ng- href = "{{user.github}}" One & gt; {{User.github}} & lt; / A & gt; & Lt; / TD & gt; & Lt; Td class = "email" & gt; & Lt; A ng- href = "mailto: {{user.email}}" & gt; {{User.email}} & lt; / A & gt; & Lt; / TD & gt; & Lt; Td class = "location" & gt; {{User.city}} & lt; / Td> & Lt; Td square = "step" & gt; {{User.searchStage === 'Out'? 'Opt Out': user.searchStage}} & lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt;  

I need to change the second TD, which is currently displaying 'Yes' or 'No' with the check box, the problem is that when clicked on the check box Toggle should be done and should not redirect I-sref like the rest TD

I have a working solution that hardcodes the UI-SRF in each except the check-box:

  & lt; Tbody & gt; & Lt; Tr ng-repeat = "user in group | order by: sorter: reverse" class = "tablebox-content" & gt; & Lt; Td ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "name" & gt; {{User.name}} & lt; / Td> & Lt; Td> & Lt; Input type = "checkbox" ng-model = "user.attending" & gt; & Lt; / Td> & Lt; Td ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "interest denied" & gt; {{User.interestDeclared}} & lt; / Td> & Lt; TD ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "interestThreeOrGreater" & gt; {{User.interestThreeOrGreater}} & lt; / TD & gt; & Lt; TD ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "GitHub" & gt; & Lt; A ng- href = "{{user.github}}" One & gt; {{User.github}} & lt; / A & gt; & Lt; / TD & gt; & Lt; Td ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "email" & gt; & Lt; A ng-href = "mail :: {{user.email}}" & gt; {{User.email}} & lt; / A & gt; & Lt; / TD & gt; & Lt; Td ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "location" & gt; {{User.city}} & lt; / Td> & Lt; Td ui-sref = "admin.candidates.detail ({_ id: user._id})" class = "step" & gt; {{User.searchStage === 'Out'? 'Opt Out': user.searchStage}} & lt; / Td> & Lt; / TR & gt; & Lt; / Tbody & gt;  

Is there a more elegant and / or an approach to implementing this solution?

You can do just that:

  & lt; Tbody & gt; & Lt; Tr ng-repeat = "user in group | order by: sorter: reverse" class = "tablebox-content" ui-sref = "admin.candidates.detail ({_ id: user._id})" & gt; & Lt; Td class = "name" & gt; {{User.name}} & lt; / Td> & Lt; Td ng-click = "$ event.stopPropagation ()" & gt; & Lt; Input type = "checkbox" ng-model = "user." And "gt;  & lt; td class =" interest declined "& gt; {{user.interestDeclared}} & lt; / td & gt; & lt; td class =" interestThreeOrGreater " Gt; {{user.interestThreeOrGreater}} & lt; / td & gt; & lt; td class = "GitHub"> 

Comments

Popular posts from this blog

Member with no value in F# -

java - Joda Time Interval Not returning what I expect -

c# - Showing a SelectedItem's Property -