ng-click on a select

1,683 views
Skip to first unread message

Michael P. Soulier

unread,
May 21, 2013, 11:00:02 AM5/21/13
to ang...@googlegroups.com
Hi,

I'm currenting using ng-repeat like so

<div ng-switch on="networkoptions.physicalmode">
<!-- This shows when the wired option is selected. -->
<div class="row-fluid mbg-row" ng-switch-when="wired">
<div class="span3 right-justify shaded-background">
<label for="wiredmode">Mode:</label>
</div>
<div class="span2 left-justify"
ng-repeat="choice in wiredmode_choices">
<input type="radio"
name="wiredmode"
value="{{ choice.private }}"
ng-click="$parent.toggleWiredMode"
required
ng-model="$parent.networkoptions.wiredmode" />
&nbsp;<span ng-bind="choice.public"></span>

everything works except that the ng-click isn't firing the toggleWiredMode
function in the $scope. Am I doing this wrong?

Thanks,
Mike

Nicolas Grenet

unread,
May 21, 2013, 12:02:23 PM5/21/13
to ang...@googlegroups.com
hmm... toggleWiredMode is a function ? then try $parent.toggleWiredMode().

If it doesn't works, try $parent.$parent.toggleWiredMode() (you're in a sub sub scope : ng-switch AND ng-repeat)

Maybe dirty, but it works for me.

Michael P. Soulier

unread,
May 21, 2013, 6:31:42 PM5/21/13
to ang...@googlegroups.com
On 21/05/13 Nicolas Grenet said:

> hmm... toggleWiredMode is a function ? then try $parent.toggleWiredMode*()*.
>
> If it doesn't works, try $parent.$parent.toggleWiredMode() (you're in a
> sub sub scope : ng-switch AND ng-repeat)
>
> Maybe dirty, but it works for me.

No, I tried just an ng-click="alert('foo')" and that doesn't fire at all.

I tried ng-change as well.

The event doesn't seem to fire.

Mike

>
> On 21/05/2013 17:00, Michael P. Soulier wrote:
> > Hi,
> >
> > I'm currenting using ng-repeat like so
> >
> > <div ng-switch on="networkoptions.physicalmode">
> > <!-- This shows when the wired option is selected. -->
> > <div class="row-fluid mbg-row" ng-switch-when="wired">
> > <div class="span3 right-justify shaded-background">
> > <label for="wiredmode">Mode:</label>
> > </div>
> > <div class="span2 left-justify"
> > ng-repeat="choice in wiredmode_choices">
> > <input type="radio"
> > name="wiredmode"
> > value="{{ choice.private }}"
> > ng-click="$parent.toggleWiredMode"
> > required
> > ng-model="$parent.networkoptions.wiredmode" />
> > &nbsp;<span ng-bind="choice.public"></span>
> >
> > everything works except that the ng-click isn't firing the toggleWiredMode
> > function in the $scope. Am I doing this wrong?
> >
> > Thanks,
> > Mike
> >
>
> --
> You received this message because you are subscribed to the Google Groups "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
> To post to this group, send email to ang...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular?hl=en-US.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages