Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8854473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:53:19+00:00 2026-06-14T13:53:19+00:00

I am building radio buttons dynamically. ng-change=’newValue(value) stops being called after each radio button

  • 0

I am building radio buttons dynamically. ng-change='newValue(value) stops being called after each radio button has been pressed once.

this works: Clicking on the radio buttons changes the value to foo/bar/baz.
http://jsfiddle.net/ZPcSe/19/

<div ng-controller="MyCtrl">
<input type="radio" ng-model="value" value="foo" ng-change='newValue(value)'>
<input type="radio" ng-model="value" value="bar" ng-change='newValue(value)'>
<input type="radio" ng-model="value" value="baz" ng-change='newValue(value)'>    
<hr>
{{value}}
</div>

this code does not: The {{value}} – “label” is not updated once each radio button has been pressed at least once. Aparently ng-change is not fired any more.

<div ng-controller="MyCtrl">
    <span ng-repeat="i in [0, 1, 2]">
    <input name="asdf" type="radio" ng-model="value" value={{i}} ng-change='newValue(value)'>   
    </span>
    {{value}}
</div>

http://jsfiddle.net/ZPcSe/18/

The Controlles is the same each time:

var myApp = angular.module('myApp', []);

function MyCtrl($scope) {
    $scope.value = '-';
    $scope.newValue = function(value) {
    $scope.value = value;
    }
}

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:53:20+00:00Added an answer on June 14, 2026 at 1:53 pm

    ngRepeat creates new scope, so trying to set value sets it on the new scope. The workaround is to reference a property on an object that is on the parent scope–the object lookup happens on the parent scope, and then changing the property works as expected:

    HTML:

    <div ng-controller="MyCtrl">
    <span ng-repeat="i in [0, 1, 2]">
      <input name="asdf" ng-model="options.value" value="{{i}}" type="radio">
    </span>
    {{options.value}}
    

    JS:

    var myApp = angular.module('myApp', []);
    
    function MyCtrl($scope) {
        $scope.options = {
            value: '-'
        };
        $scope.newValue = function(value) {
            // $scope.options.value = value; // not needed, unless you want to do more work on a change
        }
    }​
    

    You can check out a working fiddle of this workaround. See angular/angular.js#1100 on GitHub for more information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jQMobile 1.0, and building a list of radio buttons dynamically from json
Building an inventory system. I have lots of products and each product has three
I am building a search form which needs multiple fields. A radio button indicates
I have a flex MXML UI that is building a set of radio buttons
I'm building a form with radio buttons. <form id=land name=input method=POST action=test.php> <input type=radio
I'm building custom content filtering system using custom radio buttons. There are some problems
I'm building a form to allow someone to change the color of buttons, to
I'm building a multiple-choice questionnaire, using jQuery to toggle radio buttons on hover. I
I'm building an iPhone app for a local radio station. They have an URL
Building a website that has English & Japanese speaking users, with the Japanese users

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.